Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Use language name for sort order instead of identifier. Fix a few outdated comments #4055

Merged
merged 1 commit into from
Sep 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions app/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ exports.translation = function (token) {
if (translations[token]) {
return translations[token]
} else {
// This will return an identifier in upper case enclosed in square brackets
// Useful for determining if a translation was not requested in the menu
// This will return an identifier in upper case useful for determining if a translation was not requested in the menu
// identifiers above.
return token.toUpperCase()
}
Expand All @@ -231,33 +230,33 @@ exports.translation = function (token) {
const DEFAULT_LANGUAGE = 'en-US'

const availableLanguages = [
'eu',
'bn-BD',
'bn-IN',
'zh-CN',
'cs',
'de-DE',
'nl-NL',
'en-US',
'es',
'eu',
'fr-FR',
'de-DE',
'hi-IN',
'id-ID',
'it-IT',
'ja-JP',
'ko-KR',
'ms-MY',
'nl-NL',
'pl-PL',
'pt-BR',
'ru',
'sl',
'es',
'ta',
'te',
'tr-TR',
'uk',
'zh-CN'
'uk'
]

// Currently configured languages - TODO (make this dynamic)
// Currently configured languages
const configuredLanguages = {}
availableLanguages.forEach(function (lang) {
configuredLanguages[lang] = true
Expand All @@ -284,9 +283,7 @@ const defaultLocale = function () {
}
}

// Initialize translations for a language providing an optional
// callback executed after the translation caching process
// is complete.
// Initialize translations for a language
exports.init = function (language) {
// If this is in the main process
if (ipcMain) {
Expand All @@ -309,7 +306,7 @@ exports.init = function (language) {
// Currently selected language identifier I.e. 'en-US'
lang = language || defaultLocale()

// Languages to support - TODO retrieve this dynamically
// Languages to support
const langs = availableLanguages.map(function (lang) {
return { code: lang }
})
Expand Down