Skip to content

Commit

Permalink
🌐 back,front: Rename Vietnamese code to correct ISO of "vi", added to…
Browse files Browse the repository at this point in the history
… selector in account settings (#364)
  • Loading branch information
ericlinagora committed Oct 14, 2024
1 parent e2ac054 commit 359a537
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 469 deletions.
File renamed without changes.
9 changes: 3 additions & 6 deletions tdrive/backend/node/src/cli/cmds/dev_cmds/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ import parseYargsCommaSeparatedStringArray from "../../utils/yargs-comma-array";
import { NonPlatformCommandYargsBuilder } from "../../utils/non-plaform-command-yargs-builder";
import { openWithSystemViewer } from "../../../utils/exec";

const CORE_LANGUAGES = "en fr ru vn".split(" ");

// const iso639ToTwakeDriveISO = set1 => (set1 === "vi" ? "vn" : set1);
const twakeDriveISOToISO639 = twakeLang => (twakeLang === "vn" ? "vi" : twakeLang);
const CORE_LANGUAGES = "en fr ru vi".split(" ");

const TEMPLATE_VAR_NAME = "TDCLI_TRANSLATOR_URL";
const urlToTranslate = (text: string, to: string, from?: string) => {
const template = process.env[TEMPLATE_VAR_NAME];
if (!template) throw new Error(`${TEMPLATE_VAR_NAME} environment variable must be set.`);
const variables = {
to: twakeDriveISOToISO639(to),
from: from ? twakeDriveISOToISO639(from) : from,
to,
from,
text,
};
return template.replace(/%\{([^}:]+)(?::([^}]+))?\}/g, (_, varName, absentValue) => {
Expand Down
2 changes: 1 addition & 1 deletion tdrive/backend/node/src/services/general/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { Languages } from "./types";

export const languages: Languages = {
default: "en",
availables: ["en", "fr", "es", "vn", "ru"],
availables: ["en", "fr", "es", "vi", "ru"],
};
Loading

0 comments on commit 359a537

Please sign in to comment.