diff --git a/index.js b/index.js index bb39321daf..e53330fe2e 100644 --- a/index.js +++ b/index.js @@ -40,7 +40,8 @@ import moment from './lib/module/moment'; import Hammer from './lib/module/hammer'; import keycharm from 'keycharm'; -moment.locale('en') +const defaultLanguage = DOMutil.getNavigatorLanguage() +moment.locale(defaultLanguage) const timeline = { Core , diff --git a/lib/DOMutil.js b/lib/DOMutil.js index 74f8e88b18..2bc9d8e7e8 100644 --- a/lib/DOMutil.js +++ b/lib/DOMutil.js @@ -217,4 +217,16 @@ export function drawBar (x, y, width, height, className, JSONcontainer, svgConta rect.setAttributeNS(null, "style", style); } } -} \ No newline at end of file +} + +/** + * get default language + * @returns {string} + */ +export function getNavigatorLanguage() { + if (navigator.languages && navigator.languages.length) { + return navigator.languages; + } else { + return navigator.userLanguage || navigator.language || navigator.browserLanguage || 'en'; + } +}