Skip to content

Commit faffb64

Browse files
committed
test: Added test for linked files
Adds tests for linked files, including error handling for cyclic dependencies and missing files. Includes a fix to consider the `useOnlyLangCode` flag.
1 parent 90db15f commit faffb64

16 files changed

+303
-8
lines changed

i18n/en-cyclic.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"test": "cyclic_test",
3+
"cycle_start": ":/cycle_file1.json"
4+
}

i18n/en-cyclic/cycle_file1.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"file1_value": "This is file 1",
3+
"link_to_file2": ":/cycle_file2.json"
4+
}

i18n/en-cyclic/cycle_file2.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"file2_value": "This is file 2",
3+
"link_back_to_file1": ":/cycle_file1.json"
4+
}

i18n/en-linked.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"test": "test_linked_en",
3+
"hello": "Hello",
4+
"app": {
5+
"name": "Test App",
6+
"errors": ":/errors.json"
7+
},
8+
"validation": ":/validation.json",
9+
"nested": {
10+
"module": {
11+
"messages": ":/nested/messages.json"
12+
}
13+
},
14+
"multiple": {
15+
"errors": ":/multi_errors.json",
16+
"validation": ":/multi_validation.json"
17+
},
18+
"deep_nested": ":/deep/level1.json"
19+
}

i18n/en-linked/deep/level1.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"level1_value": "This is level 1",
3+
"level2": ":/deep/level2.json"
4+
}

i18n/en-linked/deep/level2.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"level2_value": "This is level 2",
3+
"final_message": "Deep nesting works!"
4+
}

i18n/en-linked/errors.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"not_found": "Resource not found",
3+
"server_error": "Internal server error",
4+
"invalid_input": "Invalid input provided"
5+
}

i18n/en-linked/multi_errors.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"not_found": "Multiple resource not found",
3+
"server_error": "Multiple internal server error",
4+
"invalid_input": "Multiple invalid input provided"
5+
}

i18n/en-linked/multi_validation.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"required": "Multiple field is required",
3+
"email": "Multiple valid email address required",
4+
"min_length": "Multiple minimum length is {min} characters",
5+
"max_length": "Multiple maximum length is {max} characters"
6+
}

i18n/en-linked/nested/messages.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"welcome": "Welcome to our app",
3+
"goodbye": "Thank you for using our app",
4+
"info": "This is a nested message file"
5+
}

0 commit comments

Comments
 (0)