Merge pull request #39 from chrisgarrity/rtl-support

Add RTL support
This commit is contained in:
chrisgarrity 2018-08-23 11:23:24 -04:00 committed by GitHub
commit 75fa9f93e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -16,6 +16,7 @@ import gl from 'react-intl/locale-data/gl';
import he from 'react-intl/locale-data/he'; import he from 'react-intl/locale-data/he';
import hu from 'react-intl/locale-data/hu'; import hu from 'react-intl/locale-data/hu';
import id from 'react-intl/locale-data/id'; import id from 'react-intl/locale-data/id';
import is from 'react-intl/locale-data/is';
import it from 'react-intl/locale-data/it'; import it from 'react-intl/locale-data/it';
import ja from 'react-intl/locale-data/ja'; import ja from 'react-intl/locale-data/ja';
import ko from 'react-intl/locale-data/ko'; import ko from 'react-intl/locale-data/ko';
@ -35,7 +36,7 @@ import uk from 'react-intl/locale-data/uk';
import vi from 'react-intl/locale-data/vi'; import vi from 'react-intl/locale-data/vi';
import zh from 'react-intl/locale-data/zh'; import zh from 'react-intl/locale-data/zh';
import locales, {customLocales} from './supported-locales.js'; import locales, {customLocales, isRtl} from './supported-locales.js';
/* /*
locales = { locales = {
'ab': {name: 'Аҧсшәа'}, 'ab': {name: 'Аҧсшәа'},
@ -85,6 +86,7 @@ let localeData = [].concat(
he, he,
hu, hu,
id, id,
is,
it, it,
ja, ja,
ko, ko,
@ -111,5 +113,6 @@ for (const lang in customLocales) {
export { export {
locales as default, locales as default,
isRtl,
localeData // data expected for initializing ReactIntl.addLocaleData localeData // data expected for initializing ReactIntl.addLocaleData
}; };

View file

@ -74,6 +74,15 @@ const customLocales = {
} }
}; };
// list of RTL locales supported, and a function to check whether a locale is RTL
const rtlLocales = [
'he'
];
const isRtl = locale => {
return rtlLocales.indexOf(locale) !== -1;
};
const wwwLocales = { const wwwLocales = {
'ab': {name: 'Аҧсшәа'}, 'ab': {name: 'Аҧсшәа'},
'ar': {name: 'العربية'}, 'ar': {name: 'العربية'},
@ -150,4 +159,4 @@ const wwwLocales = {
'zh-tw': {name: '繁體中文'} 'zh-tw': {name: '繁體中文'}
}; };
export {locales as default, customLocales, wwwLocales}; export {locales as default, customLocales, rtlLocales, isRtl, wwwLocales};