From 1597009dde2030d525af5b3c3150e9d8bc2e33af Mon Sep 17 00:00:00 2001 From: Roman Pushkin Date: Mon, 6 Feb 2017 18:50:13 -0800 Subject: [PATCH] #494 Itegrate Persian and Chinese Mandarin translations --- src/actions/menu/select-locale.js | 8 ++++++-- src/validations/supported-locales.js | 2 ++ test/i18n-test.js | 2 +- test/menu/select-locale-test.js | 18 ++++++++++-------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/actions/menu/select-locale.js b/src/actions/menu/select-locale.js index 801f80e4..3cd610e5 100644 --- a/src/actions/menu/select-locale.js +++ b/src/actions/menu/select-locale.js @@ -93,8 +93,8 @@ export default class SelectLocale extends Action { { label: localeMap.get('es'), value: 'es' }, ], [ - { label: localeMap.get('id'), value: 'id' }, - { label: localeMap.get('pt-br'), value: 'pt-br' }, + { label: localeMap.get('fa'), value: 'fa' }, + { label: localeMap.get('zh-cn'), value: 'zh-cn' }, ], [ { label: localeMap.get('ru'), value: 'ru' }, @@ -114,6 +114,10 @@ export default class SelectLocale extends Action { .add(new TextResponse({ message: 'Select your language (page 2/2):' })) .add(new OptionsResponse({ rows: [ + [ + { label: localeMap.get('id'), value: 'id' }, + { label: localeMap.get('pt-br'), value: 'pt-br' }, + ], [ { label: localeMap.get('fr'), value: 'fr' }, { label: localeMap.get('de'), value: 'de' }, diff --git a/src/validations/supported-locales.js b/src/validations/supported-locales.js index 3b03b326..49fa25db 100644 --- a/src/validations/supported-locales.js +++ b/src/validations/supported-locales.js @@ -18,6 +18,8 @@ localeMap.set('ru', '🇷🇺 Русский'); localeMap.set('tr', '🇹🇷 Türkçe'); localeMap.set('fr', 'Français'); localeMap.set('de', 'Deutsch'); +localeMap.set('fa', 'فارسی'); +localeMap.set('zh-cn', '官话'); /** * @typedef SupportedLocales diff --git a/test/i18n-test.js b/test/i18n-test.js index 3c3571a2..820febc7 100644 --- a/test/i18n-test.js +++ b/test/i18n-test.js @@ -3,7 +3,7 @@ import walk from 'walk'; import oboe from 'oboe'; import fs from 'fs'; -const NUM_OF_LOCALIZATIONS = 8; +const NUM_OF_LOCALIZATIONS = 10; test.cb('locales should have all keys from en.json, except *_desc', t => { t.plan(NUM_OF_LOCALIZATIONS - 1); diff --git a/test/menu/select-locale-test.js b/test/menu/select-locale-test.js index d67b1e61..02bd45e5 100644 --- a/test/menu/select-locale-test.js +++ b/test/menu/select-locale-test.js @@ -17,8 +17,8 @@ const assertPage1 = (t, response) => { t.is(response.responses[1].type, 'options'); t.is(response.responses[1].rows[0][0].value, 'en'); t.is(response.responses[1].rows[0][1].value, 'es'); - t.is(response.responses[1].rows[1][0].value, 'id'); - t.is(response.responses[1].rows[1][1].value, 'pt-br'); + t.is(response.responses[1].rows[1][0].value, 'fa'); + t.is(response.responses[1].rows[1][1].value, 'zh-cn'); t.is(response.responses[1].rows[2][0].value, 'ru'); t.is(response.responses[1].rows[2][1].value, 'page2'); }; @@ -28,10 +28,12 @@ const assertPage2 = (t, response) => { t.is(response.responses[0].type, 'text'); t.is(response.responses[0].message, 'Select your language (page 2/2):'); t.is(response.responses[1].type, 'options'); - t.is(response.responses[1].rows[0][0].value, 'fr'); - t.is(response.responses[1].rows[0][1].value, 'de'); - t.is(response.responses[1].rows[1][0].value, 'page1'); - t.is(response.responses[1].rows[1][1].value, 'tr'); + t.is(response.responses[1].rows[0][0].value, 'id'); + t.is(response.responses[1].rows[0][1].value, 'pt-br'); + t.is(response.responses[1].rows[1][0].value, 'fr'); + t.is(response.responses[1].rows[1][1].value, 'de'); + t.is(response.responses[1].rows[2][0].value, 'page1'); + t.is(response.responses[1].rows[2][1].value, 'tr'); }; test('should return conditional response on get', t => { @@ -72,7 +74,7 @@ const assertPost = (t, response) => { t.is(response.responses[2].condition.type, 'in'); t.is(response.responses[2].condition.value, 'foo'); t.deepEqual(response.responses[2].condition.arr, - ['en', 'es', 'id', 'pt-br', 'ru', 'tr', 'fr', 'de']); + ['en', 'es', 'id', 'pt-br', 'ru', 'tr', 'fr', 'de', 'fa', 'zh-cn']); assertConfirm(t, response.responses[2].ok); t.is(response.responses[2].condition.err, undefined); }; @@ -84,7 +86,7 @@ test('should return conditional response on post', t => { t.is(response.condition.type, 'in'); t.is(response.condition.value, 'foo'); t.deepEqual(response.condition.arr, - ['en', 'es', 'id', 'pt-br', 'ru', 'tr', 'fr', 'de', 'page1', 'page2']); + ['en', 'es', 'id', 'pt-br', 'ru', 'tr', 'fr', 'de', 'fa', 'zh-cn', 'page1', 'page2']); assertPost(t, response.ok); t.is(response.err, undefined); });