Skip to content

Commit

Permalink
#494 Itegrate Persian and Chinese Mandarin translations
Browse files Browse the repository at this point in the history
  • Loading branch information
ro31337 committed Feb 7, 2017
1 parent b8b7fde commit 1597009
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
8 changes: 6 additions & 2 deletions src/actions/menu/select-locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand All @@ -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' },
Expand Down
2 changes: 2 additions & 0 deletions src/validations/supported-locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/i18n-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 10 additions & 8 deletions test/menu/select-locale-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
};
Expand All @@ -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 => {
Expand Down Expand Up @@ -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);
};
Expand All @@ -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);
});

0 comments on commit 1597009

Please sign in to comment.