Skip to content

Commit

Permalink
Fixing ts file and exporting raw json files
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede committed Mar 8, 2020
1 parent d5ec1c9 commit 3bde5ae
Show file tree
Hide file tree
Showing 8 changed files with 620 additions and 535 deletions.
16 changes: 12 additions & 4 deletions expo-package/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4879,6 +4879,13 @@ hyphenate-style-name@^1.0.2:
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.3.tgz#097bb7fa0b8f1a9cf0bd5c734cf95899981a9b48"
integrity sha512-EcuixamT82oplpoJ2XU4pDtKGWQ7b00CD9f1ug9IaQ3p1bkHMiKCZ9ut9QDI6qsa6cpUuB+A/I+zLtdNK4n2DQ==

i18next@^19.3.1:
version "19.3.2"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-19.3.2.tgz#a17c3c8bb0dd2d8c4a8963429df99730275b3282"
integrity sha512-QDBQ8MqFWi4+L9OQjjZEKVyg9uSTy3NTU3Ri53QHe7nxtV+KD4PyLB8Kxu58gr6b9y5l8cU3mCiNHVeoxPMzAQ==
dependencies:
"@babel/runtime" "^7.3.1"

[email protected], iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@~0.4.13:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
Expand Down Expand Up @@ -8820,10 +8827,10 @@ stream-buffers@~2.2.0:
resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4"
integrity sha1-kdX1Ew0c75bc+n9yaUUYh0HQnuQ=

stream-chat-react-native-core@v0.6.6:
version "0.6.6"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-0.6.6.tgz#0a19821c4382944dad174984f60764409007fb0c"
integrity sha512-g4/7Q0bfm/6paU/ND5z19H3dtyuGRzZotY04MGah6GdXltas/I9Kw9Or9p7pfZ88ige+1389VAEoEzX+dLsjAA==
stream-chat-react-native-core@v0.7.0-i18n-rc.0:
version "0.7.0-i18n-rc.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-0.7.0-i18n-rc.0.tgz#ef9e5753cefb725b21c664f9fd2d80c20ca88d7a"
integrity sha512-IgJQHygrRLaQmkjRvi53lRPG6tPUh7XOwbUkKKHQkLYkSjn4b34WFW3snlU/tZy4u7C5bSryTDJWxcbd3GDzdQ==
dependencies:
"@babel/runtime" "^7.1.2"
"@stream-io/react-native-simple-markdown" "^1.1.1"
Expand All @@ -8833,6 +8840,7 @@ [email protected]:
deep-equal "^1.0.1"
deepmerge "^3.2.0"
file-loader "^3.0.1"
i18next "^19.3.1"
lodash-es "^4.17.11"
metro-react-native-babel-preset "^0.53.1"
mime-types "^2.1.24"
Expand Down
422 changes: 214 additions & 208 deletions native-package/yarn.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"rollup": "^0.68.2",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-commonjs": "^9.1.8",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-replace": "^2.1.0",
Expand Down
4 changes: 4 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import babel from 'rollup-plugin-babel';
import external from 'rollup-plugin-peer-deps-external';
import commonjs from 'rollup-plugin-commonjs';
import copy from 'rollup-plugin-copy';
import json from 'rollup-plugin-json';
import images from './rollup-react-native-image.js';
import path from 'path';
Expand Down Expand Up @@ -102,6 +103,9 @@ const normalBundle = {
}),
commonjs(),
json(),
copy({
targets: [{ src: 'src/i18n/*.json', dest: 'dist/i18n' }],
}),
],
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const Chat = themed(
}

streami18n.registerSetLanguageCallback((t) => {
this.setState({ t, moment });
this.setState({ t });
});

const { t, moment } = await streami18n.getTranslators();
Expand Down
3 changes: 3 additions & 0 deletions src/utils/Streami18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ export class Streami18n {
* - language (String) default: 'en'
* Language code e.g., en, tr
*
* - translationsForLanguage (object)
* Translations object. Please check src/i18n/en.json for example.
*
* - disableDateTimeTranslations (boolean) default: false
* Disable translations for datetimes
*
Expand Down
23 changes: 16 additions & 7 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,15 +950,16 @@ export function registerNativeHandlers(handlers: {

export interface Streami18nOptions {
language: string;
disableDateTimeTranslations: boolean;
debug: boolean;
logger(msg: string): any;
momentLocaleConfigForLanguage: object;
disableDateTimeTranslations?: boolean;
translationsForLanguage?: object;
debug?: boolean;
logger?(msg: string): any;
momentLocaleConfigForLanguage?: object;
}

export interface Streami18nTranslators {
t?: i18next.TFunction;
moment?(): moment.Moment;
t: i18next.TFunction;
moment(datetime: moment.MomentInput): moment.Moment;
}

export class Streami18n {
Expand All @@ -974,7 +975,7 @@ export class Streami18n {
registerTranslation(
key: String,
translation: Object,
customMomentLocale: moment.LocaleSpecification,
customMomentLocale?: moment.LocaleSpecification,
): void;
addOrUpdateMomentLocaleConfig(
key: String,
Expand All @@ -983,3 +984,11 @@ export class Streami18n {
setLanguage(language: String): Promise<void>;
registerSetLanguageCallback(callback: (t: i18next.TFunction) => void): void;
}

export const enTranslations: object;
export const nlTranslations: object;
export const ruTranslations: object;
export const trTranslations: object;
export const frTranslations: object;
export const hiTranslations: object;
export const itTranslations: object;
Loading

0 comments on commit 3bde5ae

Please sign in to comment.