Skip to content

Commit

Permalink
added localization
Browse files Browse the repository at this point in the history
  • Loading branch information
OkancanCosar committed Dec 8, 2020
1 parent 771654b commit ace077d
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Package usage and installation processes that may be required for React-native a
- Lottie [Handbook](docs/lottie.md) | [Commit](https://github.com/OkancanCosar/react-native-basics-setups/commit/ff5763c903b12032efd6d4e215088c28c01bcaec)
- Splash Screen [Handbook](docs/splash.md) | [Commit](https://github.com/OkancanCosar/react-native-basics-setups/commit/d711e0f5395983844a32cd3de718d39627090f12)
- Module Resolver [Handbook](docs/moduleresolver.md) | [Commit](https://github.com/OkancanCosar/react-native-basics-setups/commit/198091cf454011b9da3769a372479f5341680a50)
- Localization [Handbook](docs/localization.md) | [Commit]()
19 changes: 19 additions & 0 deletions docs/localization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Localization handbook

[offical react-native-localization](https://yarnpkg.com/package/react-native-localization)

#### Install Localization package in the project

```bash
$ yarn add react-native-localization
```

#### Usage

[Example](../src/components/strings/)

```js
import { Strings } from "./components/strings";

<Text style={styles.x}> {Strings.CodePush.ChangeLogs} </Text>;
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-code-push": "^6.4.0",
"react-native-localization": "^2.1.6",
"react-native-splash-screen": "^3.2.0"
},
"devDependencies": {
Expand Down
18 changes: 18 additions & 0 deletions src/components/strings/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export const en = {
CodePush: {
ChangeLogs: "\n\nChangeLogs:\n\n\n",
AlertTitle: "There is a new update!",
AlertMessage: "Would you like to download the new update?",
AlertBtnInstall: "Download and Restart",
AlertBtnIgnore: "Remind me later",
Status: p => `% ${p} completed.`,
UpdateChecking: "Checking for updates ...",
WaitingAction: "Your permission is pending to start the update.",
UpdateDownloading: "Downloading update ...",
UpdateInstalling: "Installing update ...",
UpToDate: "You are currently using the most current version.",
UpdateCanceled: "The update has been canceled. For the best experience, you should keep your app updated!",
UpdateInstalled: "The installation is complete. The application is restarting.",
UpdateUnknownError: "An unknown error has occurred.",
},
};
6 changes: 6 additions & 0 deletions src/components/strings/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import LocalizedStrings from "react-native-localization";
import { tr } from "./tr";
import { en } from "./en";
import { it } from "./it";

export const Strings = new LocalizedStrings({ en, tr, it });
19 changes: 19 additions & 0 deletions src/components/strings/it.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const it = {
CodePush: {
ChangeLogs: "\n\nChangeLogs:\n\n\n",
AlertTitle: "C'è un nuovo aggiornamento!",
AlertMessage: "Vuoi scaricare il nuovo aggiornamento?",
AlertBtnInstall: "Scarica e riavvia",
AlertBtnIgnore: "Ricordamelo più tardi",
Status: p => `% ${p} completato.`,
UpdateChecking: "Verifica aggiornamenti ...",
WaitingAction: "La tua autorizzazione è in attesa di avviare l'aggiornamento.",
UpdateDownloading: "Download aggiornamento in corso ...",
UpdateInstalling: "Installazione aggiornamento ...",
UpToDate: "Stai attualmente utilizzando la versione più recente.",
UpdateCanceled:
"L'aggiornamento è stato annullato. Per la migliore esperienza, dovresti mantenere aggiornata la tua app!",
UpdateInstalled: "L'installazione è completa. L'applicazione si sta riavviando.",
UpdateUnknownError: "Si è verificato un errore sconosciuto.",
},
};
14 changes: 4 additions & 10 deletions src/components/Strings.js → src/components/strings/tr.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
//import LocalizedStrings from 'react-native-localization';

export const Strings = /* new LocalizedStrings({
en: {},
tr:*/ {
export const tr = {
CodePush: {
ChangeLogs: "\n\nYeniliklikler:\n\n\n",
AlertTitle: "Yeni bir güncelleme var!",
Expand All @@ -14,11 +10,9 @@ export const Strings = /* new LocalizedStrings({
WaitingAction: "Güncellemeye başlamak için izniniz bekleniyor...",
UpdateDownloading: "Güncelleme indiriliyor...",
UpdateInstalling: "Güncelleme yükleniyor...",
UpToDate: "Şuanda en güncel sürümü kullanıyorsunuz.",
UpdateCanceled: "Güncelleme iptal edildi. En iyi deneyim için uygulamanızı güncel tutmalısınız",
UpToDate: "Şu anda en güncel sürümü kullanıyorsunuz.",
UpdateCanceled: "Güncelleme iptal edildi. En iyi deneyim için uygulamanızı güncel tutmalısınız!",
UpdateInstalled: "Yükleme tamamlandı. Uygulama tekrar başlatılıyor.",
UpdateUnknownError: "Bilinmeyen bir hata oluştu.",
},
}; /*,
it: {},
});*/
};
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import CodePush from "react-native-code-push";
import SplashScreen from "react-native-splash-screen";

import { Strings } from "./components/Strings";
import { Strings } from "./components/strings";
import App from "./App";
import { UpdateApp, AnimEnums } from "./components/complex/UpdateApp";

Expand Down
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4529,6 +4529,11 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=

localized-strings@^0.2.0:
version "0.2.4"
resolved "https://registry.yarnpkg.com/localized-strings/-/localized-strings-0.2.4.tgz#9d61c06b60cc7b5edf7c46e6c7f2d1ecb84aeb2c"
integrity sha512-TKDhqFPkIIN/if2FSvVVZTaM/GP9TzfgdQ2uY65mr32xgFu5nqkKXprXbzy5rfx32DF5LDvS/y1UqYF/mAscYA==

locate-path@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"
Expand Down Expand Up @@ -5802,6 +5807,13 @@ react-is@^16.12.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-i
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==

react-localization@^1.0.14:
version "1.0.15"
resolved "https://registry.yarnpkg.com/react-localization/-/react-localization-1.0.15.tgz#624bd0b514100488a84204e20b398750313d1708"
integrity sha512-s+yK3EqPUhN8kAfUIoA5m0a0iGOvxB3DrvngYnSZNLRQRX+yS7LYfTuKT66KVa3Cr6EP4iGRtw4XRqpsi1ZLjw==
dependencies:
localized-strings "^0.2.0"

react-native-code-push@^6.4.0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/react-native-code-push/-/react-native-code-push-6.4.0.tgz#82fcfd52604e0c6bed527e03d120a211f163e2f3"
Expand All @@ -5815,6 +5827,13 @@ react-native-code-push@^6.4.0:
semver "^7.3.2"
xcode "3.0.1"

react-native-localization@^2.1.6:
version "2.1.6"
resolved "https://registry.yarnpkg.com/react-native-localization/-/react-native-localization-2.1.6.tgz#86d50a09d50495a5b9b789c3981acbd5cb0c38b7"
integrity sha512-L0ZKfN49TtZJoBJZ4M5Uh+d/q5GB0Vpbd/fmysfXljOAwZiy2h1ZlytTnbjElYp61FELZmvyXymlgt4kvVpx1A==
dependencies:
react-localization "^1.0.14"

react-native-safe-modules@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/react-native-safe-modules/-/react-native-safe-modules-1.0.0.tgz#10a918adf97da920adb1e33e0c852b1e80123b65"
Expand Down

0 comments on commit ace077d

Please sign in to comment.