Skip to content

Commit

Permalink
i18n: adds turkish support
Browse files Browse the repository at this point in the history
refactor: converter extension to .pot
  • Loading branch information
mb-wali committed Jun 28, 2021
1 parent a550481 commit 6f6fa45
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"unlink-dist": "cd dist && npm unlink && rm package*",
"watch": "NODE_ENV=development rollup --watch -c",
"i18n-scan": "i18next-scanner --config i18next-scanner.config.js src/**/*.{js,jsx}",
"i18n-conv-json": "i18next-conv -l en -s ./src/lib/translations/en/translations.json -t ./src/lib/translations/en/translations.po",
"i18n-conv-json": "i18next-conv -l en -s ./src/lib/translations/en/translations.json -t ./src/lib/translations/translations.pot",
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint src/**/*.js",
Expand All @@ -40,8 +40,7 @@
"semantic-ui-css": "^2.4.1",
"@babel/runtime": "^7.9.0",
"i18next": "^20.3.1",
"i18next-browser-languagedetector": "^6.1.1",
"react-i18next": "^11.11.0"
"i18next-browser-languagedetector": "^6.1.1"
},
"devDependencies": {
"@babel/cli": "^7.5.5",
Expand Down
13 changes: 4 additions & 9 deletions src/lib/i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,17 @@
// React-Invenio-Deposit is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.

// I18next dependencies
// npm install react-i18next i18next i18next-browser-languagedetector --save

import i18next from 'i18next';

import TRANSLATIONS_DE from './translations/de/translations.json';
import TRANSLATIONS_EN from './translations/en/translations.json';
import TRANSLATIONS_TR from './translations/tr/translations.json';

import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';

i18next
// detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector
.use(LanguageDetector)
// pass the i18n instance to react-i18next.
.use(initReactI18next)
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
fallbackLng: 'en',
debug: true,
Expand All @@ -33,6 +25,9 @@ i18next
de: {
translation: TRANSLATIONS_DE,
},
tr: {
translation: TRANSLATIONS_TR,
},
},
// specify language detection order
detection: {
Expand Down
5 changes: 5 additions & 0 deletions src/lib/translations/tr/translations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"New version": "New version",
"New upload": "New upload",
"Edit upload": "Edit upload"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2021-06-25T10:09:29.684Z\n"
"PO-Revision-Date: 2021-06-25T10:09:29.684Z\n"
"POT-Creation-Date: 2021-06-28T11:40:44.007Z\n"
"PO-Revision-Date: 2021-06-28T11:40:44.007Z\n"
"Language: en\n"

msgid "New version"
Expand Down

0 comments on commit 6f6fa45

Please sign in to comment.