Skip to content

Commit

Permalink
- (Grizzlebee) only translate linkText from messages if existent
Browse files Browse the repository at this point in the history
-   (Apollon77) Add ukrainian as language for translations
  • Loading branch information
Apollon77 committed Oct 23, 2022
1 parent 720fbb0 commit b51999d
Show file tree
Hide file tree
Showing 23 changed files with 480 additions and 402 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ module.exports = {
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->

### __WORK IN PROGRESS__
- (Grizzlebee) only translate linkText from messages if existent
- (Apollon77) Add ukrainian as language for translations

### 1.1.0 (2022-09-14)
- (Grizzelbee) Also translate admin messages in io-package.json
- (AlCalzone) support specifying raw esbuild options, like loaders/plugins
Expand Down
5 changes: 4 additions & 1 deletion build/translate-adapter-handlers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/translate-adapter-handlers.js.map

Large diffs are not rendered by default.

790 changes: 407 additions & 383 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@
"@tsconfig/node12": "^1.0.11",
"@types/chai": "^4.3.3",
"@types/fs-extra": "^9.0.13",
"@types/iobroker": "^4.0.4",
"@types/mocha": "^9.1.1",
"@types/node": "^18.7.23",
"@types/iobroker": "^4.0.5",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.3",
"@types/rimraf": "^3.0.2",
"@types/yargs": "^17.0.12",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"@types/yargs": "^17.0.13",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"dir-compare": "^4.0.0",
"eslint": "^8.24.0",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"mocha": "^10.0.0",
"mocha": "^10.1.0",
"prettier": "^2.7.1",
"prettier-plugin-organize-imports": "^3.1.1",
"rimraf": "^3.0.2",
Expand All @@ -77,10 +77,10 @@
"@google-cloud/translate": "^7.0.3",
"ansi-colors": "^4.1.3",
"axios": "^0.27.2",
"esbuild": "^0.15.10",
"esbuild": "^0.15.12",
"@esm2cjs/execa": "^6.1.1-cjs.1",
"fs-extra": "^10.1.0",
"tiny-glob": "^0.2.9",
"yargs": "^17.5.1"
"yargs": "^17.6.0"
}
}
5 changes: 4 additions & 1 deletion src/translate-adapter-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const _languages: Record<ioBroker.Languages, any> = {
it: {},
es: {},
pl: {},
uk: {},
"zh-cn": {},
};
export const allLanguages = Object.keys(_languages) as ioBroker.Languages[];
Expand Down Expand Up @@ -197,7 +198,9 @@ async function translateIoPackage(): Promise<void> {
console.log(` Message: ${message.title.en}`);
await translateNotExisting(message.title);
await translateNotExisting(message.text);
await translateNotExisting(message.linkText);
if (message.linkText) {
await translateNotExisting(message.linkText);
}
}
}
await writeJson(ioPackage, content, { spaces: 4, EOL });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Example": "Mock translation of 'Example' to 'uk'"
}
10 changes: 7 additions & 3 deletions test/data/continue-translate-io-package/expected/io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"it": "Mock translation of 'Next version' to 'it'",
"es": "Mock translation of 'Next version' to 'es'",
"pl": "Mock translation of 'Next version' to 'pl'",
"uk": "Mock translation of 'Next version' to 'uk'",
"zh-cn": "Mock translation of 'Next version' to 'zh-cn'"
},
"1.0.0": {
Expand All @@ -23,7 +24,8 @@
"it": "My translation of 'Initial version' to 'it'",
"es": "My translation of 'Initial version' to 'es'",
"pl": "My translation of 'Initial version' to 'pl'",
"zh-cn": "My translation of 'Initial version' to 'zh-cn'"
"zh-cn": "My translation of 'Initial version' to 'zh-cn'",
"uk": "Mock translation of 'Initial version' to 'uk'"
}
},
"titleLang": {
Expand All @@ -36,7 +38,8 @@
"it": "My translation of 'My title' to 'it'",
"es": "My translation of 'My title' to 'es'",
"pl": "My translation of 'My title' to 'pl'",
"zh-cn": "My translation of 'My title' to 'zh-cn'"
"zh-cn": "My translation of 'My title' to 'zh-cn'",
"uk": "Mock translation of 'My title' to 'uk'"
},
"desc": {
"en": "My description",
Expand All @@ -48,7 +51,8 @@
"it": "My translation of 'My description' to 'it'",
"es": "My translation of 'My description' to 'es'",
"pl": "My translation of 'My description' to 'pl'",
"zh-cn": "My translation of 'My description' to 'zh-cn'"
"zh-cn": "My translation of 'My description' to 'zh-cn'",
"uk": "Mock translation of 'My description' to 'uk'"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Example": "Mock translation of 'Example' to 'uk'"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Example": "Приклад"
}
1 change: 1 addition & 0 deletions test/data/no-json-yet/expected/admin/words.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ systemDictionary = {
it: "Esempio",
es: "Ejemplo",
pl: "Przykład",
uk: "Приклад",
"zh-cn": "例子",
},
};
1 change: 1 addition & 0 deletions test/data/no-json-yet/input/admin/words.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ systemDictionary = {
it: "Esempio",
es: "Ejemplo",
pl: "Przykład",
uk: "Приклад",
"zh-cn": "例子",
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Example": "Приклад"
}
2 changes: 1 addition & 1 deletion test/data/no-words-yet/expected/admin/words.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
'use strict';

systemDictionary = {
"Example": { "en": "Example", "de": "Beispiel", "ru": "пример", "pt": "Exemplo", "nl": "Voorbeeld", "fr": "Exemple", "it": "Esempio", "es": "Ejemplo", "pl": "Przykład", "zh-cn": "例子"},
"Example": { "en": "Example", "de": "Beispiel", "ru": "пример", "pt": "Exemplo", "nl": "Voorbeeld", "fr": "Exemple", "it": "Esempio", "es": "Ejemplo", "pl": "Przykład", "uk": "Приклад", "zh-cn": "例子"},
};
3 changes: 3 additions & 0 deletions test/data/no-words-yet/input/admin/i18n/uk/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Example": "Приклад"
}
3 changes: 3 additions & 0 deletions test/data/translate-io-package/expected/io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"it": "Mock translation of 'Initial version' to 'it'",
"es": "Mock translation of 'Initial version' to 'es'",
"pl": "Mock translation of 'Initial version' to 'pl'",
"uk": "Mock translation of 'Initial version' to 'uk'",
"zh-cn": "Mock translation of 'Initial version' to 'zh-cn'"
}
},
Expand All @@ -24,6 +25,7 @@
"it": "Mock translation of 'My title' to 'it'",
"es": "Mock translation of 'My title' to 'es'",
"pl": "Mock translation of 'My title' to 'pl'",
"uk": "Mock translation of 'My title' to 'uk'",
"zh-cn": "Mock translation of 'My title' to 'zh-cn'"
},
"desc": {
Expand All @@ -36,6 +38,7 @@
"it": "Mock translation of 'My description' to 'it'",
"es": "Mock translation of 'My description' to 'es'",
"pl": "Mock translation of 'My description' to 'pl'",
"uk": "Mock translation of 'My description' to 'uk'",
"zh-cn": "Mock translation of 'My description' to 'zh-cn'"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Example": "Приклад",
"Example 2": "Приклад 2"
}
2 changes: 2 additions & 0 deletions test/data/update-json/expected/admin/words.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ systemDictionary = {
it: "Esempio",
es: "Ejemplo",
pl: "Przykład",
uk: "Приклад",
"zh-cn": "例子",
},
"Example 2": {
Expand All @@ -24,6 +25,7 @@ systemDictionary = {
it: "Esempio 2",
es: "Ejemplo 2",
pl: "Przykład 2",
uk: "Приклад 2",
"zh-cn": "例子2",
},
};
3 changes: 3 additions & 0 deletions test/data/update-json/input/admin/i18n/uk/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Example": "Приклад"
}
2 changes: 2 additions & 0 deletions test/data/update-json/input/admin/words.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ systemDictionary = {
it: "Esempio",
es: "Ejemplo",
pl: "Przykład",
uk: "Приклад",
"zh-cn": "例子",
},
"Example 2": {
Expand All @@ -24,6 +25,7 @@ systemDictionary = {
it: "Esempio 2",
es: "Ejemplo 2",
pl: "Przykład 2",
uk: "Приклад 2",
"zh-cn": "例子2",
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Example": "Приклад",
"Example 2": "Приклад 2"
}
4 changes: 2 additions & 2 deletions test/data/update-words/expected/admin/words.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions test/data/update-words/input/admin/i18n/uk/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Example": "Приклад",
"Example 2": "Приклад 2"
}

0 comments on commit b51999d

Please sign in to comment.