Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use json format v4 for translations #403

Merged
merged 11 commits into from
May 13, 2024
Merged
15 changes: 1 addition & 14 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,5 @@ module.exports = {
'@babel/preset-react',
'@babel/preset-typescript'
],
plugins: [
'babel-plugin-styled-components',
[
'i18next-extract',
{
outputPath: 'translations/{{ns}}.json',
defaultContexts: [],
defaultNS: 'en',
jsonSpace: 4,
compatibilityJSON: 'v3',
discardOldKeys: false
}
]
]
plugins: ['babel-plugin-styled-components']
};
1,154 changes: 521 additions & 633 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
"poststart": "npm run postbuild:pkg",
"packTo": "npm pack --pack-destination $PKG_PATH && cd $PKG_PATH && npm i zextras-carbonio-shell-ui-$npm_package_version.tgz",
"packTo:noBuild": "cp zextras-carbonio-shell-ui-$npm_package_version.tgz $PKG_PATH/ && cd $PKG_PATH && npm i zextras-carbonio-shell-ui-$npm_package_version.tgz",
"deploy-on-module": "npm pack && rm -rf $PKG_PATH/node_modules/@zextras/carbonio-shell-ui/* && tar -xf zextras-carbonio-shell-ui-$npm_package_version.tgz -C $PKG_PATH/node_modules/@zextras/carbonio-shell-ui/ --strip-components 1",
"translations:push": "git subtree push --prefix translations $npm_package_config_translations_repository translations-updater/$(date '+%Y-%m-%d')",
"translations:pull": "git subtree pull --squash --prefix translations $npm_package_config_translations_repository master"
"deploy-on-module": "npm pack && rm -rf $PKG_PATH/node_modules/@zextras/carbonio-shell-ui/* && tar -xf zextras-carbonio-shell-ui-$npm_package_version.tgz -C $PKG_PATH/node_modules/@zextras/carbonio-shell-ui/ --strip-components 1"
},
"files": [
"lib/",
Expand Down Expand Up @@ -73,10 +71,9 @@
"@types/webpack": "^5.28.5",
"@types/webpack-env": "^1.18.4",
"@zextras/carbonio-ui-configs": "^1.0.0",
"@zextras/carbonio-ui-sdk": "^1.7.1",
"@zextras/carbonio-ui-sdk": "^1.7.2",
"autoprefixer": "^10.4.17",
"babel-loader": "^9.1.3",
"babel-plugin-i18next-extract": "^0.10.0",
"babel-plugin-styled-components": "^2.1.4",
"copy-webpack-plugin": "^12.0.2",
"core-js": "^3.36.0",
Expand Down Expand Up @@ -107,9 +104,9 @@
"@reduxjs/toolkit": "^1.9.7",
"@sentry/browser": "^7.103.0",
"@tinymce/tinymce-react": "^4.3.2",
"@zextras/carbonio-design-system": "^5.0.0",
"@zextras/carbonio-ui-preview": "^1.2.3",
"darkreader": "^4.9.79",
"@zextras/carbonio-design-system": "^5.0.0",
"@zextras/carbonio-ui-preview": "^1.2.3",
"darkreader": "^4.9.79",
"history": "^5.3.0",
"i18next": "^22.5.1",
"i18next-http-backend": "^2.5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/i18next.d.ts
nubsthead marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare module 'i18next' {
[defaultNs: i18next.TypeOptions['defaultNS']]: typeof en;
};
returnNull: false;
jsonFormat: 'v3';
jsonFormat: 'v4';
allowObjectInHTMLChildren: true;
}
}
2 changes: 1 addition & 1 deletion src/store/i18n/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const defaultI18n = i18next.createInstance({ lng: defaultLng });
const defaultI18nInitOptions: InitOptions = {
returnEmptyString: true,
returnNull: false,
compatibilityJSON: 'v3',
compatibilityJSON: 'v4',
lng: defaultLng,
fallbackLng: 'en',
debug: false,
Expand Down
1 change: 0 additions & 1 deletion translations/ar.json

This file was deleted.

438 changes: 0 additions & 438 deletions translations/de.json

This file was deleted.

1 change: 0 additions & 1 deletion translations/en-US.json

This file was deleted.

Loading