Commit d495befe authored by Orin Jaworski's avatar Orin Jaworski Committed by Commit Bot

[omnibox] Add 'am' language support for Pedals

This CL adds a single language data set to serve
as a minimal example of how to cover all aspects
including JSON data, header, unit tests, etc.

Bug: 893183
Change-Id: Iee33b87dbb331946652c64dbf9c1714c1c8879f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2347972Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarmanuk hovanesian <manukh@chromium.org>
Commit-Queue: Orin Jaworski <orinj@chromium.org>
Auto-Submit: Orin Jaworski <orinj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798323}
parent b5bad6a0
......@@ -24,9 +24,14 @@ TEST(OmniboxPedals, DataLoadsForAllLocales) {
std::string trigger;
};
const TestCase test_cases[] = {
{"de", "leeren cache"}, {"en", "clear history"},
{"fr", "supprime historique"}, {"ja", "消す 履歴"},
// clang-format off
{"am", "ሰርዝ ታሪክ"},
{"de", "leeren cache"},
{"en", "clear history"},
{"fr", "supprime historique"},
{"ja", "消す 履歴"},
{"zh-CN", "清除 数据"},
// clang-format on
};
for (const TestCase& test_case : test_cases) {
// Prepare the shared ResourceBundle with data for tested locale.
......@@ -38,6 +43,18 @@ TEST(OmniboxPedals, DataLoadsForAllLocales) {
OmniboxPedalProvider provider(client);
EXPECT_EQ(provider.FindPedalMatch(base::UTF8ToUTF16("")), nullptr);
#if defined(OS_CHROMEOS)
// TODO(orinj): Get ChromeOS to use the right dataset, but for now make this
// a soft failure so as to not block all other platforms. To ensure this
// is not going to cause failure in production, still test that English
// triggering functions. Data is there; it works; but warn about locale.
if (!provider.FindPedalMatch(base::UTF8ToUTF16(test_case.trigger))) {
EXPECT_NE(provider.FindPedalMatch(base::UTF8ToUTF16("clear history")),
nullptr);
LOG(WARNING) << "ChromeOS using English for locale " << test_case.locale;
continue;
}
#endif
EXPECT_NE(provider.FindPedalMatch(base::UTF8ToUTF16(test_case.trigger)),
nullptr)
<< "locale: " << test_case.locale;
......
......@@ -10,7 +10,7 @@
// This value is generated during Pedal concept data processing, and written
// to all data files as well as the source code here to ensure synchrony.
// The runtime loaded data must match this version exactly or it won't load.
constexpr int OMNIBOX_PEDAL_CONCEPTS_DATA_VERSION = 15453828;
constexpr int OMNIBOX_PEDAL_CONCEPTS_DATA_VERSION = 15462706;
// Unique identifiers for Pedals, used to bind loaded data to implementations.
enum class OmniboxPedalId {
......
{
"schema": "pedals_translation_model",
"schema_version": 1,
"time_generated": "2020-08-04T19:48:33.665131874+00:00",
"time_generated": "2020-08-10T23:46:42.165601123+00:00",
"primary_language_code": "en",
"locales": [
{
"language_code": "am",
"tokenize_characters": " -",
"ignore_group": {
"required": false,
"single": false,
"synonyms": [
"በዚህ ውስጥ",
"እንዴት",
"ውስጥ",
"ለ"
]
},
"pedals": [
{
"name": "CLEAR_BROWSING_DATA",
"groups": [
{
"required": false,
"single": true,
"synonyms": [
"google chrome",
"አሳሽ",
"ማሰስ",
"chrome"
]
},
{
"required": true,
"single": true,
"synonyms": [
"አስወግድ",
"ደምስስ",
"ሰርዝ",
"አጥፋ",
"አጽዳ"
]
},
{
"required": true,
"single": true,
"synonyms": [
"መሸጎጫ",
"ኩኪዎች",
"ታሪክ",
"ውሂብ",
"መረጃ",
"መረጃ"
]
}
]
},
{
"name": "MANAGE_PASSWORDS",
"groups": [
{
"required": false,
"single": true,
"synonyms": [
"google chrome",
"አሳሽ",
"chrome"
]
},
{
"required": true,
"single": true,
"synonyms": [
"አቀናባሪ",
"አቀናብር",
"አስቀምጥ",
"ይመልከቱ",
"አርትዕ",
"አዘምን",
"ለውጥ",
"አሳይ"
]
},
{
"required": true,
"single": true,
"synonyms": [
"የይለፍ ቃላት",
"ምስክርነቶች",
"የይለፍ ቃል"
]
}
]
},
{
"name": "UPDATE_CREDIT_CARD",
"groups": [
{
"required": false,
"single": true,
"synonyms": [
"google chrome",
"አሳሽ",
"chrome"
]
},
{
"required": true,
"single": true,
"synonyms": [
"አቀናብር",
"አስቀምጥ",
"አዘምን",
"አርትዕ",
"ለውጥ"
]
},
{
"required": true,
"single": true,
"synonyms": [
"የክሬዲት ካርድ መረጃ",
"የክሬዲት ካርድ መረጃ",
"የመክፈያ ዘዴዎች",
"ክሬዲት ካርዶች",
"ክሬዲት ካርድ",
"የካርድ መረጃ",
"የካርድ መረጃ",
"ክፍያዎች",
"ካርዶች",
"ክፍያ"
]
}
]
},
{
"name": "LAUNCH_INCOGNITO",
"groups": [
{
"required": false,
"single": true,
"synonyms": [
"google chrome",
"አሳሽ",
"chrome"
]
},
{
"required": false,
"single": true,
"synonyms": [
"አስጀምር",
"አስገባ",
"ጀምር",
"ክፈት",
"ፍጠር"
]
},
{
"required": true,
"single": true,
"synonyms": [
"ማንነት የማያሳውቅ መስኮት",
"ማንነት የማያሳውቅ ሁነታ",
"ማንነት የማያሳውቅ ትር",
"ማንነት የማያሳውቅ",
"የግል መስኮት",
"የግል ሁነታ",
"የግል ትር"
]
}
]
},
{
"name": "TRANSLATE",
"groups": [
{
"required": false,
"single": true,
"synonyms": [
"google chrome",
"አሳሽ",
"chrome"
]
},
{
"required": true,
"single": true,
"synonyms": [
"ቋንቋ ቀይር",
"ተርጉም"
]
},
{
"required": true,
"single": true,
"synonyms": [
"ይህ ገጽ",
"ገጽ",
"ይህ"
]
}
]
},
{
"name": "UPDATE_CHROME",
"groups": [
{
"required": true,
"single": true,
"synonyms": [
"google chrome",
"አሳሽ",
"chrome"
]
},
{
"required": true,
"single": true,
"synonyms": [
"አዘምን",
"አልቅ",
"ጫን"
]
}
]
}
]
},
{
"language_code": "de",
"tokenize_characters": " -",
......
{
"schema": "pedal_concepts_runtime",
"schema_version": 1,
"data_version": 15462706,
"tokenize_characters": " -",
"dictionary": [
"chrome",
"google",
"ሁነታ",
"ለ",
"ለውጥ",
"መረጃ",
"መስኮት",
"መሸጎጫ",
"ማሰስ",
"ማንነት",
"ምስክርነቶች",
"ሰርዝ",
"ቀይር",
"ቃላት",
"ቃል",
"ቋንቋ",
"በዚህ",
"ተርጉም",
"ታሪክ",
"ትር",
"አልቅ",
"አርትዕ",
"አሳሽ",
"አሳይ",
"አስቀምጥ",
"አስወግድ",
"አስጀምር",
"አስገባ",
"አቀናባሪ",
"አቀናብር",
"አዘምን",
"አጥፋ",
"አጽዳ",
"እንዴት",
"ኩኪዎች",
"ካርድ",
"ካርዶች",
"ክሬዲት",
"ክፈት",
"ክፍያ",
"ክፍያዎች",
"ውሂብ",
"ውስጥ",
"ዘዴዎች",
"የመክፈያ",
"የማያሳውቅ",
"የካርድ",
"የክሬዲት",
"የይለፍ",
"የግል",
"ይህ",
"ይመልከቱ",
"ደምስስ",
"ጀምር",
"ገጽ",
"ጫን",
"ፍጠር"
],
"pedals": [
{
"name": "CLEAR_BROWSING_DATA",
"id": 1,
"groups": [
{
"required": false,
"single": true,
"synonyms": [
[
1,
0
],
[
22
],
[
8
],
[
0
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
25
],
[
52
],
[
11
],
[
31
],
[
32
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
7
],
[
34
],
[
18
],
[
41
],
[
5
],
[
5
]
]
}
]
},
{
"name": "MANAGE_PASSWORDS",
"id": 2,
"groups": [
{
"required": false,
"single": true,
"synonyms": [
[
1,
0
],
[
22
],
[
0
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
28
],
[
29
],
[
24
],
[
51
],
[
21
],
[
30
],
[
4
],
[
23
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
48,
13
],
[
48,
14
],
[
10
]
]
}
]
},
{
"name": "UPDATE_CREDIT_CARD",
"id": 3,
"groups": [
{
"required": false,
"single": true,
"synonyms": [
[
1,
0
],
[
22
],
[
0
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
29
],
[
24
],
[
30
],
[
21
],
[
4
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
47,
35,
5
],
[
47,
35,
5
],
[
44,
43
],
[
37,
36
],
[
37,
35
],
[
46,
5
],
[
46,
5
],
[
40
],
[
36
],
[
39
]
]
}
]
},
{
"name": "LAUNCH_INCOGNITO",
"id": 4,
"groups": [
{
"required": false,
"single": true,
"synonyms": [
[
1,
0
],
[
22
],
[
0
]
]
},
{
"required": false,
"single": true,
"synonyms": [
[
26
],
[
27
],
[
53
],
[
38
],
[
56
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
9,
45,
6
],
[
9,
45,
2
],
[
9,
45,
19
],
[
9,
45
],
[
49,
6
],
[
49,
2
],
[
49,
19
]
]
}
]
},
{
"name": "TRANSLATE",
"id": 5,
"groups": [
{
"required": false,
"single": true,
"synonyms": [
[
1,
0
],
[
22
],
[
0
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
15,
12
],
[
17
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
50,
54
],
[
54
],
[
50
]
]
}
]
},
{
"name": "UPDATE_CHROME",
"id": 6,
"groups": [
{
"required": true,
"single": true,
"synonyms": [
[
1,
0
],
[
22
],
[
0
]
]
},
{
"required": true,
"single": true,
"synonyms": [
[
30
],
[
20
],
[
55
]
]
}
]
}
],
"ignore_group": {
"required": false,
"single": false,
"synonyms": [
[
16,
42
],
[
33
],
[
42
],
[
3
]
]
},
"max_tokens": 32
}
\ No newline at end of file
{
"schema": "pedal_concepts_runtime",
"schema_version": 1,
"data_version": 15453828,
"data_version": 15462706,
"tokenize_characters": " -",
"dictionary": [
"aktualisieren",
......
{
"schema": "pedal_concepts_runtime",
"schema_version": 1,
"data_version": 15453828,
"data_version": 15462706,
"tokenize_characters": " -",
"dictionary": [
"a",
......
{
"schema": "pedal_concepts_runtime",
"schema_version": 1,
"data_version": 15453828,
"data_version": 15462706,
"tokenize_characters": " -",
"dictionary": [
"actualise",
......
{
"schema": "pedal_concepts_runtime",
"schema_version": 1,
"data_version": 15453828,
"data_version": 15462706,
"tokenize_characters": "",
"dictionary": [
" ",
......
{
"schema": "pedal_concepts_runtime",
"schema_version": 1,
"data_version": 15453828,
"data_version": 15462706,
"tokenize_characters": "",
"dictionary": [
" ",
......
......@@ -110,6 +110,9 @@
<release seq="1" allow_pseudo="false">
<includes>
<!-- These resources do not require translation or further processing because they are already handled by a separate localization process. -->
<if expr="lang == 'am'">
<include name="IDR_OMNIBOX_PEDAL_CONCEPTS" file="omnibox_pedal_concepts_am.json" type="BINDATA" compress="gzip" />
</if>
<if expr="lang == 'de'">
<include name="IDR_OMNIBOX_PEDAL_CONCEPTS" file="omnibox_pedal_concepts_de.json" type="BINDATA" compress="gzip" />
</if>
......@@ -125,7 +128,7 @@
<if expr="lang == 'zh-CN'">
<include name="IDR_OMNIBOX_PEDAL_CONCEPTS" file="omnibox_pedal_concepts_zh-CN.json" type="BINDATA" compress="gzip" />
</if>
<if expr="lang not in ['de', 'en', 'fr', 'ja', 'zh-CN']">
<if expr="lang not in ['am', 'de', 'en', 'fr', 'ja', 'zh-CN']">
<!-- Fall back to English for unsupported languages. -->
<include name="IDR_OMNIBOX_PEDAL_CONCEPTS" file="omnibox_pedal_concepts_en.json" type="BINDATA" compress="gzip" />
</if>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment