Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
feat(i18n): use custom Chinese language names
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Sep 18, 2018
1 parent 2322bf0 commit 2fb1e2e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/lib/utils/i18n.js
Expand Up @@ -85,7 +85,8 @@ export const locales = [
'sv',
'tr',
'uk',
'zh'
'zh-CN',
'zh-TW'
]

// Defaine list of currencies that we will support.
Expand Down Expand Up @@ -165,6 +166,15 @@ export const getLocale = () => {
* @return {string} Language code.
*/
export const getLanguageName = lang => {
const customNames = {
el: 'Greek',
'zh-CN': 'Chinese (Simplified, PRC)',
'zh-TW': 'Chinese (Traditional, Taiwan)'
}
if (customNames[lang]) {
return customNames[lang]
}

const language = lang.toLowerCase().split(/[_-]+/)[0]
const data = lookup.languages({ alpha2: language })
const name = get(data, '[0]name', language)
Expand Down

0 comments on commit 2fb1e2e

Please sign in to comment.