Skip to content

Commit 3bde5ae

Browse files
Fixing ts file and exporting raw json files
1 parent d5ec1c9 commit 3bde5ae

File tree

8 files changed

+620
-535
lines changed

8 files changed

+620
-535
lines changed

expo-package/yarn.lock

+12-4
Original file line numberDiff line numberDiff line change
@@ -4879,6 +4879,13 @@ hyphenate-style-name@^1.0.2:
48794879
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.3.tgz#097bb7fa0b8f1a9cf0bd5c734cf95899981a9b48"
48804880
integrity sha512-EcuixamT82oplpoJ2XU4pDtKGWQ7b00CD9f1ug9IaQ3p1bkHMiKCZ9ut9QDI6qsa6cpUuB+A/I+zLtdNK4n2DQ==
48814881

4882+
i18next@^19.3.1:
4883+
version "19.3.2"
4884+
resolved "https://registry.yarnpkg.com/i18next/-/i18next-19.3.2.tgz#a17c3c8bb0dd2d8c4a8963429df99730275b3282"
4885+
integrity sha512-QDBQ8MqFWi4+L9OQjjZEKVyg9uSTy3NTU3Ri53QHe7nxtV+KD4PyLB8Kxu58gr6b9y5l8cU3mCiNHVeoxPMzAQ==
4886+
dependencies:
4887+
"@babel/runtime" "^7.3.1"
4888+
48824889
iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@~0.4.13:
48834890
version "0.4.24"
48844891
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
@@ -8820,10 +8827,10 @@ stream-buffers@~2.2.0:
88208827
resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4"
88218828
integrity sha1-kdX1Ew0c75bc+n9yaUUYh0HQnuQ=
88228829

8823-
stream-chat-react-native-core@v0.6.6:
8824-
version "0.6.6"
8825-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-0.6.6.tgz#0a19821c4382944dad174984f60764409007fb0c"
8826-
integrity sha512-g4/7Q0bfm/6paU/ND5z19H3dtyuGRzZotY04MGah6GdXltas/I9Kw9Or9p7pfZ88ige+1389VAEoEzX+dLsjAA==
8830+
stream-chat-react-native-core@v0.7.0-i18n-rc.0:
8831+
version "0.7.0-i18n-rc.0"
8832+
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-0.7.0-i18n-rc.0.tgz#ef9e5753cefb725b21c664f9fd2d80c20ca88d7a"
8833+
integrity sha512-IgJQHygrRLaQmkjRvi53lRPG6tPUh7XOwbUkKKHQkLYkSjn4b34WFW3snlU/tZy4u7C5bSryTDJWxcbd3GDzdQ==
88278834
dependencies:
88288835
"@babel/runtime" "^7.1.2"
88298836
"@stream-io/react-native-simple-markdown" "^1.1.1"
@@ -8833,6 +8840,7 @@ stream-chat-react-native-core@v0.6.6:
88338840
deep-equal "^1.0.1"
88348841
deepmerge "^3.2.0"
88358842
file-loader "^3.0.1"
8843+
i18next "^19.3.1"
88368844
lodash-es "^4.17.11"
88378845
metro-react-native-babel-preset "^0.53.1"
88388846
mime-types "^2.1.24"

native-package/yarn.lock

+214-208
Large diffs are not rendered by default.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
"rollup": "^0.68.2",
127127
"rollup-plugin-babel": "^4.0.3",
128128
"rollup-plugin-commonjs": "^9.1.8",
129+
"rollup-plugin-copy": "^3.3.0",
129130
"rollup-plugin-json": "^3.1.0",
130131
"rollup-plugin-peer-deps-external": "^2.2.0",
131132
"rollup-plugin-replace": "^2.1.0",

rollup.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import babel from 'rollup-plugin-babel';
33
import external from 'rollup-plugin-peer-deps-external';
44
import commonjs from 'rollup-plugin-commonjs';
5+
import copy from 'rollup-plugin-copy';
56
import json from 'rollup-plugin-json';
67
import images from './rollup-react-native-image.js';
78
import path from 'path';
@@ -102,6 +103,9 @@ const normalBundle = {
102103
}),
103104
commonjs(),
104105
json(),
106+
copy({
107+
targets: [{ src: 'src/i18n/*.json', dest: 'dist/i18n' }],
108+
}),
105109
],
106110
};
107111

src/components/Chat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export const Chat = themed(
140140
}
141141

142142
streami18n.registerSetLanguageCallback((t) => {
143-
this.setState({ t, moment });
143+
this.setState({ t });
144144
});
145145

146146
const { t, moment } = await streami18n.getTranslators();

src/utils/Streami18n.js

+3
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ export class Streami18n {
168168
* - language (String) default: 'en'
169169
* Language code e.g., en, tr
170170
*
171+
* - translationsForLanguage (object)
172+
* Translations object. Please check src/i18n/en.json for example.
173+
*
171174
* - disableDateTimeTranslations (boolean) default: false
172175
* Disable translations for datetimes
173176
*

types/index.d.ts

+16-7
Original file line numberDiff line numberDiff line change
@@ -950,15 +950,16 @@ export function registerNativeHandlers(handlers: {
950950

951951
export interface Streami18nOptions {
952952
language: string;
953-
disableDateTimeTranslations: boolean;
954-
debug: boolean;
955-
logger(msg: string): any;
956-
momentLocaleConfigForLanguage: object;
953+
disableDateTimeTranslations?: boolean;
954+
translationsForLanguage?: object;
955+
debug?: boolean;
956+
logger?(msg: string): any;
957+
momentLocaleConfigForLanguage?: object;
957958
}
958959

959960
export interface Streami18nTranslators {
960-
t?: i18next.TFunction;
961-
moment?(): moment.Moment;
961+
t: i18next.TFunction;
962+
moment(datetime: moment.MomentInput): moment.Moment;
962963
}
963964

964965
export class Streami18n {
@@ -974,7 +975,7 @@ export class Streami18n {
974975
registerTranslation(
975976
key: String,
976977
translation: Object,
977-
customMomentLocale: moment.LocaleSpecification,
978+
customMomentLocale?: moment.LocaleSpecification,
978979
): void;
979980
addOrUpdateMomentLocaleConfig(
980981
key: String,
@@ -983,3 +984,11 @@ export class Streami18n {
983984
setLanguage(language: String): Promise<void>;
984985
registerSetLanguageCallback(callback: (t: i18next.TFunction) => void): void;
985986
}
987+
988+
export const enTranslations: object;
989+
export const nlTranslations: object;
990+
export const ruTranslations: object;
991+
export const trTranslations: object;
992+
export const frTranslations: object;
993+
export const hiTranslations: object;
994+
export const itTranslations: object;

0 commit comments

Comments
 (0)