Skip to content

Commit bf2fb32

Browse files
Introduced a fake language for testing
We need a fake language for tests that won't be affected by modifications made by 3rd party translators (see #749). - static/skin/i18n/hy.json was cloned as static/skin/i18n/test.json - usage of "hy" in unit-tests was replaced with "test"
1 parent b625be9 commit bf2fb32

File tree

3 files changed

+32
-11
lines changed

3 files changed

+32
-11
lines changed

static/i18n_resources_list.txt

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ skin/i18n/ru.json
1616
skin/i18n/sc.json
1717
skin/i18n/sk.json
1818
skin/i18n/sv.json
19+
skin/i18n/test.json
1920
skin/i18n/tr.json
2021
skin/i18n/zh-hans.json
2122
skin/i18n/zh-hant.json

static/skin/i18n/test.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"@metadata": {
3+
"authors": [
4+
"Kareyac"
5+
]
6+
},
7+
"name": "Հայերեն",
8+
"suggest-full-text-search": "որոնել '{{{SEARCH_TERMS}}}'...",
9+
"no-such-book": "Գիրքը բացակայում է՝ {{BOOK_NAME}}",
10+
"url-not-found": "Սխալ հասցե՝ {{url}}",
11+
"suggest-search": "Որոնել <a href=\"{{{SEARCH_URL}}}\">{{PATTERN}}</a>",
12+
"400-page-title": "Անվավեր հարցում",
13+
"400-page-heading": "Անվավեր հարցում",
14+
"404-page-title": "Սխալ հասցե",
15+
"404-page-heading": "Սխալ հասցե",
16+
"library-button-text": "Գրադարանի էջ",
17+
"home-button-text": "Դեպի '{{BOOK_TITLE}}'֊ի գլխավոր էջը",
18+
"random-page-button-text": "Բացել պատահական էջ",
19+
"searchbox-tooltip": "Որոնել '{{BOOK_TITLE}}'֊ում"
20+
}

test/server.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ const ResourceCollection resources200Uncompressible{
136136
{ STATIC_CONTENT, "/ROOT/skin/search-icon.svg?cacheid=b10ae7ed" },
137137
{ DYNAMIC_CONTENT, "/ROOT/skin/search_results.css" },
138138
{ STATIC_CONTENT, "/ROOT/skin/search_results.css?cacheid=76d39c84" },
139-
{ DYNAMIC_CONTENT, "/ROOT/skin/i18n/hy.json" },
139+
{ DYNAMIC_CONTENT, "/ROOT/skin/i18n/test.json" },
140140
// TODO: implement cache management of i18n resources
141-
//{ STATIC_CONTENT, "/ROOT/skin/i18n/hy.json?cacheid=unknown" },
141+
//{ STATIC_CONTENT, "/ROOT/skin/i18n/test.json?cacheid=unknown" },
142142

143143
{ ZIM_CONTENT, "/ROOT/raw/zimfile/meta/Title" },
144144
{ ZIM_CONTENT, "/ROOT/raw/zimfile/meta/Description" },
@@ -614,7 +614,7 @@ TEST_F(ServerTest, Http404HtmlError)
614614
</p>
615615
)" },
616616

617-
{ /* url */ "/ROOT/random?content=non-existent-book&userlang=hy",
617+
{ /* url */ "/ROOT/random?content=non-existent-book&userlang=test",
618618
expected_page_title=="Սխալ հասցե" &&
619619
expected_body==R"(
620620
<h1>Սխալ հասցե</h1>
@@ -639,7 +639,7 @@ TEST_F(ServerTest, Http404HtmlError)
639639
</p>
640640
)" },
641641

642-
{ /* url */ "/ROOT/catalog/?userlang=hy",
642+
{ /* url */ "/ROOT/catalog/?userlang=test",
643643
expected_page_title=="Սխալ հասցե" &&
644644
expected_body==R"(
645645
<h1>Սխալ հասցե</h1>
@@ -656,7 +656,7 @@ TEST_F(ServerTest, Http404HtmlError)
656656
</p>
657657
)" },
658658

659-
{ /* url */ "/ROOT/catalog/invalid_endpoint?userlang=hy",
659+
{ /* url */ "/ROOT/catalog/invalid_endpoint?userlang=test",
660660
expected_page_title=="Սխալ հասցե" &&
661661
expected_body==R"(
662662
<h1>Սխալ հասցե</h1>
@@ -713,7 +713,7 @@ TEST_F(ServerTest, Http404HtmlError)
713713
</p>
714714
)" },
715715

716-
{ /* url */ "/ROOT/content/zimfile/invalid-article?userlang=hy",
716+
{ /* url */ "/ROOT/content/zimfile/invalid-article?userlang=test",
717717
expected_page_title=="Սխալ հասցե" &&
718718
book_name=="zimfile" &&
719719
book_title=="Ray Charles" &&
@@ -1004,7 +1004,7 @@ TEST_F(ServerTest, UserLanguageControl)
10041004
/* expected <h1> */ "Not Found"
10051005
},
10061006
{
1007-
/*url*/ "/ROOT/content/zimfile/invalid-article?userlang=hy",
1007+
/*url*/ "/ROOT/content/zimfile/invalid-article?userlang=test",
10081008
/*Accept-Language:*/ "",
10091009
/* expected <h1> */ "Սխալ հասցե"
10101010
},
@@ -1015,21 +1015,21 @@ TEST_F(ServerTest, UserLanguageControl)
10151015
},
10161016
{
10171017
/*url*/ "/ROOT/content/zimfile/invalid-article",
1018-
/*Accept-Language:*/ "hy",
1018+
/*Accept-Language:*/ "test",
10191019
/* expected <h1> */ "Սխալ հասցե"
10201020
},
10211021
{
10221022
// userlang query parameter takes precedence over Accept-Language
10231023
/*url*/ "/ROOT/content/zimfile/invalid-article?userlang=en",
1024-
/*Accept-Language:*/ "hy",
1024+
/*Accept-Language:*/ "test",
10251025
/* expected <h1> */ "Not Found"
10261026
},
10271027
{
10281028
// The value of the Accept-Language header is not currently parsed.
10291029
// In case of a comma separated list of languages (optionally weighted
10301030
// with quality values) the default (en) language is used instead.
10311031
/*url*/ "/ROOT/content/zimfile/invalid-article",
1032-
/*Accept-Language:*/ "hy;q=0.9, en;q=0.2",
1032+
/*Accept-Language:*/ "test;q=0.9, en;q=0.2",
10331033
/* expected <h1> */ "Not Found"
10341034
},
10351035
};
@@ -1545,7 +1545,7 @@ R"EXPECTEDRESPONSE([
15451545
]
15461546
)EXPECTEDRESPONSE"
15471547
},
1548-
{ /* url: */ "/ROOT/suggest?content=zimfile&term=abracadabra&userlang=hy",
1548+
{ /* url: */ "/ROOT/suggest?content=zimfile&term=abracadabra&userlang=test",
15491549
R"EXPECTEDRESPONSE([
15501550
{
15511551
"value" : "abracadabra ",

0 commit comments

Comments
 (0)