mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
override/extend languages data, thanks @bgo-eiu
closes #9241 closes #9242
This commit is contained in:
@@ -5,6 +5,7 @@ const prettyStringify = require('json-stringify-pretty-compact');
|
||||
const shell = require('shelljs');
|
||||
const YAML = require('js-yaml');
|
||||
const fetch = require('node-fetch');
|
||||
const lodash = require('lodash');
|
||||
|
||||
const languageNames = require('./language_names.js');
|
||||
|
||||
@@ -70,6 +71,7 @@ function buildData() {
|
||||
|
||||
let territoryLanguages = generateTerritoryLanguages();
|
||||
fs.writeFileSync('data/territory_languages.json', prettyStringify(territoryLanguages, { maxLength: 9999 }) );
|
||||
|
||||
writeEnJson();
|
||||
|
||||
const languageInfo = languageNames.langNamesInNativeLang;
|
||||
@@ -166,6 +168,11 @@ function generateTerritoryLanguages() {
|
||||
}).map(langCode => langCode.replace('_', '-'));
|
||||
});
|
||||
|
||||
// override/adjust some territory languages which are not included in CLDR data
|
||||
territoryLanguages.pk.push('pnb', 'scl', 'trw', 'kls'); // https://github.com/openstreetmap/iD/pull/9242
|
||||
lodash.pull(territoryLanguages.pk, 'pa-Arab', 'lah', 'tg-Arab'); // - " -
|
||||
territoryLanguages.it.push('lld'); // https://en.wikipedia.org/wiki/Ladin_language
|
||||
|
||||
return territoryLanguages;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ let referencedScripts = [];
|
||||
|
||||
function getLangNamesInNativeLang() {
|
||||
// manually add languages we want that aren't in CLDR
|
||||
// see for example https://github.com/openstreetmap/iD/pull/9241/
|
||||
let unordered = {
|
||||
'oc': {
|
||||
nativeName: 'Occitan'
|
||||
@@ -30,6 +31,36 @@ function getLangNamesInNativeLang() {
|
||||
'zh_pinyin': {
|
||||
base: 'zh',
|
||||
script: 'Latn'
|
||||
},
|
||||
'bft': {
|
||||
nativeName: 'بلتی'
|
||||
},
|
||||
'bha': {
|
||||
nativeName: 'भरीयाटी'
|
||||
},
|
||||
'brh': {
|
||||
nativeName: 'براہوئی'
|
||||
},
|
||||
'kls': {
|
||||
nativeName: 'Kal\'as\'amondr'
|
||||
},
|
||||
'pnb': {
|
||||
nativeName: 'پنجابی'
|
||||
},
|
||||
'scl': {
|
||||
nativeName: 'ݜݨیاٗ'
|
||||
},
|
||||
'shg': {
|
||||
nativeName: 'хуг̌ну̊н зив'
|
||||
},
|
||||
'skr': {
|
||||
nativeName: 'سرائیکی'
|
||||
},
|
||||
'trw': {
|
||||
nativeName: 'توروالی'
|
||||
},
|
||||
'wbl': {
|
||||
nativeName: 'وخی'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -69,6 +100,10 @@ function getLangNamesInNativeLang() {
|
||||
unordered[code] = {};
|
||||
});
|
||||
|
||||
// delete codes which should not be used
|
||||
delete unordered['pa-Arab']; // https://github.com/openstreetmap/iD/pull/9241/
|
||||
delete unordered['pa-Guru']; // - " -
|
||||
|
||||
let ordered = {};
|
||||
Object.keys(unordered).sort().forEach(key => ordered[key] = unordered[key]);
|
||||
return ordered;
|
||||
|
||||
Reference in New Issue
Block a user