Skip to content

Commit 1317ec7

Browse files
committed
feat: update azure-translator-code to version 1.1.18 and add Klingon language support
fix: incorrect translation for multi lingual text.
1 parent c4ab72c commit 1317ec7

File tree

9 files changed

+23
-11
lines changed

9 files changed

+23
-11
lines changed

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@vercel/analytics": "^1.3.1",
1313
"ace-builds": "^1.34.2",
1414
"axios": "^1.7.7",
15-
"azure-translator-code": "^1.1.17",
15+
"azure-translator-code": "^1.1.18",
1616
"next": "14.2.3",
1717
"next-international": "^1.2.4",
1818
"react": "^18",

docs/src/actions/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { translate, translateText } from "azure-translator-code";
44

5-
import localesCodes from "@/lib/localesCode";
65
import { getScopedI18n } from "@/locales/server";
76

87
const key = process.env.AZURE_API_KEY ?? "";
@@ -92,7 +91,13 @@ export async function makeTranslationMultilang(
9291
}
9392

9493
const fromLang = formData.get("fromLang") as string;
95-
const toLangs = localesCodes.filter((code) => formData.get(code) === "on");
94+
const toLangs: string[] = [];
95+
96+
formData.forEach((value, key) => {
97+
if (value === "on" && key !== "fromLang" && key !== "toTranslate") {
98+
toLangs.push(key);
99+
}
100+
});
96101

97102
if (!toLangs.length) {
98103
return {

docs/src/components/FormTransLiveText/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default function FormTransLiveText({ locale }: Readonly<Locale>) {
5656
{ id: "el", name: scopedT("Langs.Greek") },
5757
{ id: "id", name: scopedT("Langs.Indonesian") },
5858
{ id: "ms", name: scopedT("Langs.Malay") },
59+
{ id: "tlh-Latn", name: scopedT("Langs.Klingon") },
5960
];
6061
return (
6162
<form

docs/src/components/FormTransMultiText/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default function FormTransMultiText({ locale }: Readonly<Locale>) {
5656
{ id: "el", name: scopedT("Langs.Greek") },
5757
{ id: "id", name: scopedT("Langs.Indonesian") },
5858
{ id: "ms", name: scopedT("Langs.Malay") },
59+
{ id: "tlh-Latn", name: scopedT("Langs.Klingon") },
5960
];
6061

6162
return (

docs/src/components/FormTransUnicJson/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default function FormTransUnicJson() {
6868
<option value="el">{scopedT("Langs.Greek")}</option>
6969
<option value="id">{scopedT("Langs.Indonesian")}</option>
7070
<option value="ms">{scopedT("Langs.Malay")}</option>
71+
<option value="tlh-Latn">{scopedT("Langs.Klingon")}</option>
7172
</select>
7273
</div>
7374
</div>
@@ -114,6 +115,7 @@ export default function FormTransUnicJson() {
114115
<option value="el">{scopedT("Langs.Greek")}</option>
115116
<option value="id">{scopedT("Langs.Indonesian")}</option>
116117
<option value="ms">{scopedT("Langs.Malay")}</option>
118+
<option value="tlh-Latn">{scopedT("Langs.Klingon")}</option>
117119
</select>
118120
</div>
119121
</div>

docs/src/locales/en/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@
8585
"Thai": "Thai",
8686
"Turkish": "Turkish",
8787
"Vietnamese": "Vietnamese",
88-
"Malay": "Malay"
88+
"Malay": "Malay",
89+
"Klingon": "Klingon"
8990
},
9091
"Paste the json code here": "Paste the json code here",
9192
"Len": "Len",

docs/src/locales/pt/pt.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@
9696
"Thai": "Tailandês",
9797
"Turkish": "Turco",
9898
"Vietnamese": "Vietnamita",
99-
"Malay": "Malaio"
99+
"Malay": "Malaio",
100+
"Klingon": "Klingon"
100101
},
101102
"Paste the json code here": "Cole o código json aqui",
102103
"Len": "Caract",

docs/src/types/translations/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ export type LanguagesCode =
2424
| "hu"
2525
| "el"
2626
| "id"
27-
| "ms";
27+
| "ms"
28+
| "tlh-Latn";

docs/yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,13 +1109,13 @@ __metadata:
11091109
languageName: node
11101110
linkType: hard
11111111

1112-
"azure-translator-code@npm:^1.1.17":
1113-
version: 1.1.17
1114-
resolution: "azure-translator-code@npm:1.1.17"
1112+
"azure-translator-code@npm:^1.1.18":
1113+
version: 1.1.18
1114+
resolution: "azure-translator-code@npm:1.1.18"
11151115
dependencies:
11161116
axios: "npm:^1.7.7"
11171117
uuid: "npm:^10.0.0"
1118-
checksum: 10c0/231036038b9109f506f2ef45ae937965cc71992a27c483373e8801522de082ba2e526fdc821792f09868cd92e79dfd52de1d9f24b89d5d022ba0f27dbd15b372
1118+
checksum: 10c0/f12a1b9b84ef9c1cc5648266a2c218d572a3b058552713c04f3b1e2a632e6f33c86f4108a98ddc73f37d64ec8c91f937ce22d5c5484e760a3c3feafa6a498cd3
11191119
languageName: node
11201120
linkType: hard
11211121

@@ -1131,7 +1131,7 @@ __metadata:
11311131
"@vercel/analytics": "npm:^1.3.1"
11321132
ace-builds: "npm:^1.34.2"
11331133
axios: "npm:^1.7.7"
1134-
azure-translator-code: "npm:^1.1.17"
1134+
azure-translator-code: "npm:^1.1.18"
11351135
eslint: "npm:^8.57.0"
11361136
eslint-config-next: "npm:14.2.3"
11371137
eslint-config-universe: "npm:^12.1.0"

0 commit comments

Comments
 (0)