Skip to content

Commit

Permalink
Refactor languages in i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmielnik committed Feb 10, 2024
1 parent 2a16440 commit 59886b2
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ npm run build -w @scrabble-solver/PACKAGE_NAME
8. Add game configs for the new locale in [packages/configs/src/languages](https://github.com/kamilmielnik/scrabble-solver/blob/master/packages/configs/src/languages)
9. Add an export for these locale configs in [packages/configs/src/languages/index.ts](https://github.com/kamilmielnik/scrabble-solver/blob/master/packages/configs/src/languages/index.ts)
10. Add a translation file in [packages/scrabble-solver/src/i18n](https://github.com/kamilmielnik/scrabble-solver/tree/master/packages/scrabble-solver/src/i18n) and fill it with translations
- Copy any existing file, e.g. `en.json` and modify it
- Copy any existing file, e.g. `english.json` and modify it
11. Add an entry for the translations in [packages/scrabble-solver/src/i18n/i18n.ts](https://github.com/kamilmielnik/scrabble-solver/tree/master/packages/scrabble-solver/src/i18n/i18n.ts)
12. Add a function to fetch the list of words in the new locale in [packages/word-lists/src/getWordList.ts](https://github.com/kamilmielnik/scrabble-solver/blob/master/packages/word-lists/src/getWordList.ts)
13. Add a function to fetch the word definition in the new locale in [packages/word-definitions/src/crawl.ts](https://github.com/kamilmielnik/scrabble-solver/blob/master/packages/word-definitions/src/crawl.ts)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 15 additions & 15 deletions packages/scrabble-solver/src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ import { Locale } from '@scrabble-solver/types';

import { Translations } from 'types';

import de from './de.json';
import en from './en.json';
import es from './es.json';
import fa from './fa.json';
import fr from './fr.json';
import pl from './pl.json';
import ro from './ro.json';
import english from './english.json';
import french from './french.json';
import german from './german.json';
import persian from './persian.json';
import polish from './polish.json';
import romanian from './romanian.json';
import spanish from './spanish.json';

const i18n: Record<Locale, Translations> = {
[Locale.DE_DE]: de,
[Locale.EN_GB]: en,
[Locale.EN_US]: en,
[Locale.ES_ES]: es,
[Locale.FA_IR]: fa,
[Locale.FR_FR]: fr,
[Locale.PL_PL]: pl,
[Locale.RO_RO]: ro,
[Locale.DE_DE]: german,
[Locale.EN_GB]: english,
[Locale.EN_US]: english,
[Locale.ES_ES]: spanish,
[Locale.FA_IR]: persian,
[Locale.FR_FR]: french,
[Locale.PL_PL]: polish,
[Locale.RO_RO]: romanian,
};

export default i18n;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 59886b2

Please sign in to comment.