Skip to content

Commit 9f05960

Browse files
Amin Benselimkodiakhq[bot]
Amin Benselim
authored andcommitted
feat(translations): add Japanese 'ja' support for UI-kit (#1191)
* feat(translations): add 'ja' support for UI-kit * Update src/index.bundlespec.js Co-Authored-By: Abel Almeida <[email protected]> * chore: fix prettier probelm
1 parent 6318d79 commit 9f05960

File tree

7 files changed

+14
-5
lines changed

7 files changed

+14
-5
lines changed

.storybook/configs/intl-context.js

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const namifyLocale = locale => {
2828
return 'Français';
2929
case 'zhCN':
3030
return '简化字';
31+
case 'ja':
32+
return '日本人';
3133
default:
3234
return locale;
3335
}

.storybook/webpack.config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const sourceFolders = [
1111

1212
module.exports = ({ config }) => {
1313
config.plugins.push(
14-
new MomentLocalesPlugin({ localesToKeep: ['de', 'es', 'fr', 'zh-cn'] })
14+
new MomentLocalesPlugin({
15+
localesToKeep: ['de', 'es', 'fr', 'zh-cn', 'ja'],
16+
})
1517
);
1618

1719
if (process.env.NODE_ENV === 'production') {

i18n/data/ja.json

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

i18n/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ import de from './data/de.json';
33
import es from './data/es.json';
44
import frFR from './data/fr-FR.json';
55
import zhCN from './data/zh-CN.json';
6+
import ja from './data/ja.json';
67

7-
export { en, de, es, frFR, zhCN };
8+
export { en, de, es, frFR, zhCN, ja };

scripts/extract-intl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const { presets, plugins } = babelConfig;
4646
// Resolve the absolute path of the caller location. This is necessary
4747
// to point to files within that folder.
4848
const rootPath = process.cwd();
49-
const locales = ['en', 'de', 'es', 'fr-FR', 'zh-CN'];
49+
const locales = ['en', 'de', 'es', 'fr-FR', 'zh-CN', 'ja'];
5050
const defaultLocale = flags.locale;
5151
const outputPath = flags['output-path'];
5252
const globFilesToParse = commands[0];

src/index.bundlespec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { i18n, customProperties, version } from 'ui-kit';
22

33
describe('exports', () => {
4-
it('should export i18n for five languages', () => {
5-
expect(Object.keys(i18n)).toEqual(['en', 'de', 'es', 'frFR', 'zhCN']);
4+
it('should export i18n for six languages', () => {
5+
expect(Object.keys(i18n)).toEqual(['en', 'de', 'es', 'frFR', 'zhCN', 'ja']);
66
});
77

88
it('should export custom-properties', () => {

src/test-utils.js

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const getMessagesForLocale = locale => {
1515
return require('../i18n/data/fr-FR.json');
1616
case 'zh-CN':
1717
return require('../i18n/data/zh-CN.json');
18+
case 'ja':
19+
return require('../i18n/data/ja.json');
1820
default:
1921
return require('../i18n/data/en.json');
2022
}

0 commit comments

Comments
 (0)