-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internationalisation, i18next, translating all languages (#403)
* add i18next * welcome * typescript * converted files * Convert all translations to i18next * Fix previous game * French * Remove some translations * Remove previous translations * Re-instate language provider * crowdin config * Crowdin config * Original languages before translations * Downloading MT translations * Chinese taditional * Arabic * Fix language loading * Setting language * Setting language * Rename all files to make plurals work * Rename all files to make plurals work * Missing translations * Migrate default langues * clean up * Linting * readme, fixes, integration tests * remove uncessary local storage * integration * fixes * fixes * Making language nullable * trying to remove vuln
- Loading branch information
1 parent
97464e5
commit d889c3b
Showing
120 changed files
with
7,696 additions
and
7,062 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: 'Alpha Build' | |
|
||
on: | ||
push: | ||
branches: [v4160/docs] | ||
branches: [v4160/i18n] | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/ormconfig.json | ||
/ormconfig.json | ||
/src/locales |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
backend/src/db/migrations/1652023488716-MigrateLanguages.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
type Mapping = { from: string; to: string }; | ||
|
||
const mappings: Mapping[] = [ | ||
{ from: 'ar', to: 'ar-SA' }, | ||
{ from: 'de', to: 'de-DE' }, | ||
{ from: 'en', to: 'en-GB' }, | ||
{ from: 'es', to: 'es-ES' }, | ||
{ from: 'fr', to: 'fr-FR' }, | ||
{ from: 'hu', to: 'hu-HU' }, | ||
{ from: 'it', to: 'it-IT' }, | ||
{ from: 'ja', to: 'ja-JP' }, | ||
{ from: 'nl', to: 'nl-NL' }, | ||
{ from: 'pl', to: 'pl-PL' }, | ||
{ from: 'pt', to: 'pt-BR' }, | ||
{ from: 'ptbr', to: 'pt-PT' }, | ||
{ from: 'ru', to: 'uk-UA' }, | ||
{ from: 'zhcn', to: 'zh-CN' }, | ||
{ from: 'zhtw', to: 'zh-TW' }, | ||
]; | ||
|
||
export class MigrateLanguages1652023488716 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
for (const mapping of mappings) { | ||
await queryRunner.query( | ||
`UPDATE users SET language = '${mapping.to}' WHERE language = '${mapping.from}';` | ||
); | ||
} | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
for (const mapping of mappings) { | ||
await queryRunner.query( | ||
`UPDATE users SET language = '${mapping.from}' WHERE language = '${mapping.to}';` | ||
); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/db/migrations/1652028782451-DefaultLanguage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {MigrationInterface, QueryRunner} from "typeorm"; | ||
|
||
export class DefaultLanguage1652028782451 implements MigrationInterface { | ||
name = 'DefaultLanguage1652028782451' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "language" SET DEFAULT 'en-GB'`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "language" SET DEFAULT 'en'`); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {MigrationInterface, QueryRunner} from "typeorm"; | ||
|
||
export class NullLanguage1652033290129 implements MigrationInterface { | ||
name = 'NullLanguage1652033290129' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "language" DROP NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "language" DROP DEFAULT`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "language" SET DEFAULT 'en-GB'`); | ||
await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "language" SET NOT NULL`); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"project_id" : "512896" | ||
"base_path" : "." | ||
"base_url" : "https://api.crowdin.com" | ||
"preserve_hierarchy": true | ||
|
||
files: [ | ||
{ | ||
"source" : "/frontend/src/translations/locales/en-GB.json", | ||
"translation" : "/frontend/src/translations/locales/%locale%.json" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ services: | |
GA_ID: '' # Optional, Google Analytics ID (UA-1234456-7) | ||
SENTRY_URL: '' # Optional, Sentry URL (https://[email protected]/1234567) | ||
GIPHY_API_KEY: '' # Optional, can be obtained here: https://developers.giphy.com/ | ||
DEFAULT_LANGUAGE: 'en' # Set the default language for new users | ||
DEFAULT_LANGUAGE: 'en-GB' # Set the default language for new users | ||
|
||
# -- Do Not Change -- | ||
BACKEND_HOST: backend # This should be the name of the backend service | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.