mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 07:25:15 +02:00
Support other locales based on browser language
This commit is contained in:
+4
-1
@@ -147,7 +147,10 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id='iD'></div><script>
|
||||
locale.current = 'en';
|
||||
locale
|
||||
.current('en')
|
||||
.current(iD.detect().locale);
|
||||
|
||||
d3.json('keys.json', function(err, keys) {
|
||||
var id = iD();
|
||||
|
||||
|
||||
+8
-2
@@ -1,8 +1,14 @@
|
||||
var locale = { current: 'en' };
|
||||
var locale = { _current: 'en' };
|
||||
|
||||
locale.current = function(_) {
|
||||
if (!arguments.length) return locale._current;
|
||||
if (locale[_] !== undefined) locale._current = _;
|
||||
return locale;
|
||||
};
|
||||
|
||||
function t(s, o) {
|
||||
var path = s.split(".").reverse(),
|
||||
rep = locale[locale.current];
|
||||
rep = locale[locale._current];
|
||||
|
||||
while (rep !== undefined && path.length) rep = rep[path.pop()];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user