mirror of
https://github.com/nextcloud/server.git
synced 2026-04-01 15:18:09 -04:00
Merge pull request #28402 from nextcloud/alias-locale-to-moment-supported-locale
Alias locales to moment supported locales
This commit is contained in:
commit
26a4d73d85
3 changed files with 24 additions and 4 deletions
4
core/js/dist/main.js
vendored
4
core/js/dist/main.js
vendored
File diff suppressed because one or more lines are too long
2
core/js/dist/main.js.map
vendored
2
core/js/dist/main.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -103,10 +103,30 @@ const initLiveTimestamps = () => {
|
|||
}, 30 * 1000)
|
||||
}
|
||||
|
||||
/**
|
||||
* Moment doesn't have aliases for every locale and doesn't parse some locale IDs correctly so we need to alias them
|
||||
*/
|
||||
const localeAliases = {
|
||||
zh: 'zh-cn',
|
||||
zh_Hans: 'zh-cn',
|
||||
zh_Hans_CN: 'zh-cn',
|
||||
zh_Hans_HK: 'zh-cn',
|
||||
zh_Hans_MO: 'zh-cn',
|
||||
zh_Hans_SG: 'zh-cn',
|
||||
zh_Hant: 'zh-hk',
|
||||
zh_Hant_HK: 'zh-hk',
|
||||
zh_Hant_MO: 'zh-mo',
|
||||
zh_Hant_TW: 'zh-tw',
|
||||
}
|
||||
let locale = OC.getLocale()
|
||||
if (Object.prototype.hasOwnProperty.call(localeAliases, locale)) {
|
||||
locale = localeAliases[locale]
|
||||
}
|
||||
|
||||
/**
|
||||
* Set users locale to moment.js as soon as possible
|
||||
*/
|
||||
moment.locale(OC.getLocale())
|
||||
moment.locale(locale)
|
||||
|
||||
/**
|
||||
* Initializes core
|
||||
|
|
|
|||
Loading…
Reference in a new issue