phetsims / chipper

Tools for developing and building PhET interactive simulations.
MIT License
11 stars 14 forks source link

Improve usage of js/data/localeInfo.js #902

Open mattpen opened 4 years ago

mattpen commented 4 years ago

I have a need to use https://github.com/phetsims/chipper/blob/master/js/data/localeInfo.js in the website-meteor project, to show a list of locales to users in "Localized Display Name" format.

I checked the way that rosetta is using this file and it seems overly complicated. We are downloading the file via a request to the Github Raw API, then doing some processing on the resulting string to turn it into a requirejs module and importing it. Copying this logic into website-meteor seems inappropriate, and would probably not perform well in that context.

The file seems to be a wrapper of what could be a basic JSON object. Would it be ok to factor out the locale info in to a json object (stored in chipper/data/localeInfo.json), then use the nodejs fs api to make it available as an ES6 module in /js/data/localeInfo.js?

I'm assigning @Denz1994 @jbphet and @jonathanolson as it looks like rosetta and yotta have dependencies on this file.

jonathanolson commented 4 years ago

That looks like it would work from my perspective.

mattpen commented 4 years ago
Proposed patch: ``` Index: data/localeInfo.json IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- data/localeInfo.json (date 1582837197000) +++ data/localeInfo.json (date 1582837197000) @@ -0,0 +1,1007 @@ +{ + "aa": { + "name": "Afar", + "localizedName": "Afar", + "direction": "ltr" + }, + "ab": { + "name": "Abkhazian", + "localizedName": "Abkhazian", + "direction": "ltr" + }, + "ae": { + "name": "Avestan", + "localizedName": "Avestan", + "direction": "rtl" + }, + "af": { + "name": "Afrikaans", + "localizedName": "Afrikaans", + "direction": "ltr" + }, + "ak": { + "name": "Akan", + "localizedName": "Akan", + "direction": "ltr" + }, + "am": { + "name": "Amharic", + "localizedName": "Amharic", + "direction": "ltr" + }, + "an": { + "name": "Aragonese", + "localizedName": "Aragonese", + "direction": "ltr" + }, + "ar": { + "name": "Arabic", + "localizedName": "العربية", + "direction": "rtl" + }, + "ar_MA": { + "name": "Arabic, Morocco", + "localizedName": "العربية (المغرب)", + "direction": "rtl" + }, + "ar_SA": { + "name": "Arabic, Saudi Arabia", + "localizedName": "العربية (السعودية)", + "direction": "rtl" + }, + "as": { + "name": "Assamese", + "localizedName": "Assamese", + "direction": "ltr" + }, + "av": { + "name": "Avaric", + "localizedName": "Avaric", + "direction": "ltr" + }, + "ay": { + "name": "Aymara", + "localizedName": "Aymara", + "direction": "ltr" + }, + "az": { + "name": "Azerbaijani", + "localizedName": "Azerbaijani", + "direction": "ltr" + }, + "ba": { + "name": "Bashkir", + "localizedName": "Bashkir", + "direction": "ltr" + }, + "be": { + "name": "Belarusian", + "localizedName": "беларускі", + "direction": "ltr" + }, + "bg": { + "name": "Bulgarian", + "localizedName": "български", + "direction": "ltr" + }, + "bh": { + "name": "Bihari", + "localizedName": "Bihari", + "direction": "ltr" + }, + "bi": { + "name": "Bislama", + "localizedName": "Bislama", + "direction": "ltr" + }, + "bm": { + "name": "Bambara", + "localizedName": "Bambara", + "direction": "ltr" + }, + "bn": { + "name": "Bengali", + "localizedName": "Bengali", + "direction": "ltr" + }, + "bo": { + "name": "Tibetan", + "localizedName": "Tibetan", + "direction": "ltr" + }, + "br": { + "name": "Breton", + "localizedName": "Breton", + "direction": "ltr" + }, + "bs": { + "name": "Bosnian", + "localizedName": "Bosnian", + "direction": "ltr" + }, + "ca": { + "name": "Catalan", + "localizedName": "català", + "direction": "ltr" + }, + "ce": { + "name": "Chechen", + "localizedName": "Chechen", + "direction": "ltr" + }, + "ch": { + "name": "Chamorro", + "localizedName": "Chamorro", + "direction": "ltr" + }, + "co": { + "name": "Corsican", + "localizedName": "Corsican", + "direction": "ltr" + }, + "cr": { + "name": "Cree", + "localizedName": "Cree", + "direction": "ltr" + }, + "cs": { + "name": "Czech", + "localizedName": "čeština", + "direction": "ltr" + }, + "cu": { + "name": "Church Slavic", + "localizedName": "Church Slavic", + "direction": "ltr" + }, + "cv": { + "name": "Chuvash", + "localizedName": "Chuvash", + "direction": "ltr" + }, + "cy": { + "name": "Welsh", + "localizedName": "Welsh", + "direction": "ltr" + }, + "da": { + "name": "Danish", + "localizedName": "Dansk", + "direction": "ltr" + }, + "de": { + "name": "German", + "localizedName": "Deutsch", + "direction": "ltr" + }, + "dv": { + "name": "Divehi", + "localizedName": "Divehi", + "direction": "ltr" + }, + "dz": { + "name": "Dzongkha", + "localizedName": "Dzongkha", + "direction": "ltr" + }, + "ee": { + "name": "Ewe", + "localizedName": "Ewe", + "direction": "ltr" + }, + "el": { + "name": "Greek", + "localizedName": "Ελληνικά", + "direction": "ltr" + }, + "en": { + "name": "English", + "localizedName": "English", + "direction": "ltr" + }, + "en_CA": { + "name": "English, Canada", + "localizedName": "English (Canada)", + "direction": "ltr" + }, + "en_GB": { + "name": "English, United Kingdom", + "localizedName": "English (United Kingdom)", + "direction": "ltr" + }, + "eo": { + "name": "Esperanto", + "localizedName": "Esperanto", + "direction": "ltr" + }, + "es": { + "name": "Spanish", + "localizedName": "español", + "direction": "ltr" + }, + "es_CO": { + "name": "Spanish, Colombia", + "localizedName": "español (Colombia)", + "direction": "ltr" + }, + "es_CR": { + "name": "Spanish, Costa Rica", + "localizedName": "español (Costa Rica)", + "direction": "ltr" + }, + "es_ES": { + "name": "Spanish, Spain", + "localizedName": "español (España)", + "direction": "ltr" + }, + "es_MX": { + "name": "Spanish, Mexico", + "localizedName": "español (México)", + "direction": "ltr" + }, + "es_PE": { + "name": "Spanish, Peru", + "localizedName": "español (Perú)", + "direction": "ltr" + }, + "et": { + "name": "Estonian", + "localizedName": "Eesti", + "direction": "ltr" + }, + "eu": { + "name": "Basque", + "localizedName": "Basque", + "direction": "ltr" + }, + "fa": { + "name": "Persian", + "localizedName": "Persian", + "direction": "rtl" + }, + "ff": { + "name": "Fulah", + "localizedName": "Fulah", + "direction": "ltr" + }, + "fi": { + "name": "Finnish", + "localizedName": "suomi", + "direction": "ltr" + }, + "fj": { + "name": "Fijian", + "localizedName": "Fijian", + "direction": "ltr" + }, + "fo": { + "name": "Faroese", + "localizedName": "Faroese", + "direction": "ltr" + }, + "fr": { + "name": "French", + "localizedName": "français", + "direction": "ltr" + }, + "fu": { + "name": "Friulian", + "localizedName": "fu", + "direction": "ltr" + }, + "fy": { + "name": "Western Frisian", + "localizedName": "Frisian", + "direction": "ltr" + }, + "ga": { + "name": "Irish", + "localizedName": "Gaeilge", + "direction": "ltr" + }, + "gd": { + "name": "Scottish Gaelic", + "localizedName": "Scottish Gaelic", + "direction": "ltr" + }, + "gl": { + "name": "Galician", + "localizedName": "Gallegan", + "direction": "ltr" + }, + "gn": { + "name": "Guarani", + "localizedName": "Guarani", + "direction": "ltr" + }, + "gu": { + "name": "Gujarati", + "localizedName": "Gujarati", + "direction": "ltr" + }, + "gv": { + "name": "Manx", + "localizedName": "Manx", + "direction": "ltr" + }, + "ha": { + "name": "Hausa", + "localizedName": "Hausa", + "direction": "ltr" + }, + "hi": { + "name": "Hindi", + "localizedName": "हिंदी", + "direction": "ltr" + }, + "ho": { + "name": "Hiri Motu", + "localizedName": "Hiri Motu", + "direction": "ltr" + }, + "hr": { + "name": "Croatian", + "localizedName": "hrvatski", + "direction": "ltr" + }, + "ht": { + "name": "Haitian", + "localizedName": "Haitian", + "direction": "ltr" + }, + "hu": { + "name": "Hungarian", + "localizedName": "magyar", + "direction": "ltr" + }, + "hy": { + "name": "Armenian", + "localizedName": "Armenian", + "direction": "ltr" + }, + "hz": { + "name": "Herero", + "localizedName": "Herero", + "direction": "ltr" + }, + "ia": { + "name": "Interlingua", + "localizedName": "Interlingua", + "direction": "ltr" + }, + "ie": { + "name": "Interlingue", + "localizedName": "Interlingue", + "direction": "ltr" + }, + "ig": { + "name": "Igbo", + "localizedName": "Igbo", + "direction": "ltr" + }, + "ii": { + "name": "Sichuan Yi", + "localizedName": "Sichuan Yi", + "direction": "ltr" + }, + "ik": { + "name": "Inupiaq", + "localizedName": "Inupiaq", + "direction": "ltr" + }, + "in": { + "name": "Indonesian", + "localizedName": "Bahasa Indonesia", + "direction": "ltr" + }, + "io": { + "name": "Ido", + "localizedName": "Ido", + "direction": "ltr" + }, + "is": { + "name": "Icelandic", + "localizedName": "íslenska", + "direction": "ltr" + }, + "it": { + "name": "Italian", + "localizedName": "italiano", + "direction": "ltr" + }, + "iu": { + "name": "Inuktitut", + "localizedName": "Inuktitut", + "direction": "ltr" + }, + "iw": { + "name": "Hebrew", + "localizedName": "עברית", + "direction": "rtl" + }, + "ja": { + "name": "Japanese", + "localizedName": "日本語", + "direction": "ltr" + }, + "ji": { + "name": "Yiddish", + "localizedName": "Yiddish", + "direction": "ltr" + }, + "jv": { + "name": "Javanese", + "localizedName": "Javanese", + "direction": "ltr" + }, + "ka": { + "name": "Georgian", + "localizedName": "Georgian", + "direction": "ltr" + }, + "kg": { + "name": "Kongo", + "localizedName": "Kongo", + "direction": "ltr" + }, + "ki": { + "name": "Kikuyu", + "localizedName": "Kikuyu", + "direction": "ltr" + }, + "kj": { + "name": "Kwanyama", + "localizedName": "Kwanyama", + "direction": "ltr" + }, + "kk": { + "name": "Kazakh", + "localizedName": "Kazakh", + "direction": "ltr" + }, + "kl": { + "name": "Kalaallisut", + "localizedName": "Greenlandic", + "direction": "ltr" + }, + "km": { + "name": "Khmer", + "localizedName": "Khmer", + "direction": "ltr" + }, + "kn": { + "name": "Kannada", + "localizedName": "Kannada", + "direction": "ltr" + }, + "ko": { + "name": "Korean", + "localizedName": "한국어", + "direction": "ltr" + }, + "kr": { + "name": "Kanuri", + "localizedName": "Kanuri", + "direction": "ltr" + }, + "ks": { + "name": "Kashmiri", + "localizedName": "Kashmiri", + "direction": "ltr" + }, + "ku": { + "name": "Kurdish", + "localizedName": "Kurdish", + "direction": "ltr" + }, + "ku_TR": { + "name": "Kurdish, Turkey", + "localizedName": "Kurdish (Turkey)", + "direction": "ltr" + }, + "kv": { + "name": "Komi", + "localizedName": "Komi", + "direction": "ltr" + }, + "kw": { + "name": "Cornish", + "localizedName": "Cornish", + "direction": "ltr" + }, + "ky": { + "name": "Kirghiz", + "localizedName": "Kirghiz", + "direction": "ltr" + }, + "la": { + "name": "Latin", + "localizedName": "Latin", + "direction": "ltr" + }, + "lb": { + "name": "Luxembourgish", + "localizedName": "Luxembourgish", + "direction": "ltr" + }, + "lg": { + "name": "Ganda", + "localizedName": "Ganda", + "direction": "ltr" + }, + "li": { + "name": "Limburgish", + "localizedName": "Limburgish", + "direction": "ltr" + }, + "lk": { + "name": "Lakota", + "localizedName": "Lakota", + "direction": "ltr" + }, + "ln": { + "name": "Lingala", + "localizedName": "Lingala", + "direction": "ltr" + }, + "lo": { + "name": "Lao", + "localizedName": "Lao", + "direction": "ltr" + }, + "lt": { + "name": "Lithuanian", + "localizedName": "Lietuvių", + "direction": "ltr" + }, + "lu": { + "name": "Luba-Katanga", + "localizedName": "Luba-Katanga", + "direction": "ltr" + }, + "lv": { + "name": "Latvian", + "localizedName": "Latviešu", + "direction": "ltr" + }, + "mg": { + "name": "Malagasy", + "localizedName": "Malagasy", + "direction": "ltr" + }, + "mh": { + "name": "Marshallese", + "localizedName": "Marshallese", + "direction": "ltr" + }, + "mi": { + "name": "Maori", + "localizedName": "Maori", + "direction": "ltr" + }, + "mk": { + "name": "Macedonian", + "localizedName": "македонски", + "direction": "ltr" + }, + "ml": { + "name": "Malayalam", + "localizedName": "Malayalam", + "direction": "ltr" + }, + "mn": { + "name": "Mongolian", + "localizedName": "Mongolian", + "direction": "ltr" + }, + "mo": { + "name": "Moldavian", + "localizedName": "Moldavian", + "direction": "ltr" + }, + "mr": { + "name": "Marathi", + "localizedName": "Marathi", + "direction": "ltr" + }, + "ms": { + "name": "Malay", + "localizedName": "Bahasa Melayu", + "direction": "ltr" + }, + "mt": { + "name": "Maltese", + "localizedName": "Malti", + "direction": "ltr" + }, + "my": { + "name": "Burmese", + "localizedName": "Burmese", + "direction": "ltr" + }, + "na": { + "name": "Nauru", + "localizedName": "Nauru", + "direction": "ltr" + }, + "nb": { + "name": "Norwegian Bokmal", + "localizedName": "Norwegian Bokmål", + "direction": "ltr" + }, + "nd": { + "name": "North Ndebele", + "localizedName": "North Ndebele", + "direction": "ltr" + }, + "ne": { + "name": "Nepali", + "localizedName": "Nepali", + "direction": "ltr" + }, + "ng": { + "name": "Ndonga", + "localizedName": "Ndonga", + "direction": "ltr" + }, + "nl": { + "name": "Dutch", + "localizedName": "Nederlands", + "direction": "ltr" + }, + "nn": { + "name": "Norwegian Nynorsk", + "localizedName": "Norwegian Nynorsk", + "direction": "ltr" + }, + "nr": { + "name": "South Ndebele", + "localizedName": "South Ndebele", + "direction": "ltr" + }, + "nv": { + "name": "Navajo", + "localizedName": "Navajo", + "direction": "ltr" + }, + "ny": { + "name": "Chichewa", + "localizedName": "Nyanja", + "direction": "ltr" + }, + "oc": { + "name": "Occitan", + "localizedName": "Occitan", + "direction": "ltr" + }, + "oj": { + "name": "Ojibwa", + "localizedName": "Ojibwa", + "direction": "ltr" + }, + "om": { + "name": "Oromo", + "localizedName": "Oromo", + "direction": "ltr" + }, + "or": { + "name": "Oriya", + "localizedName": "Oriya", + "direction": "ltr" + }, + "os": { + "name": "Ossetian", + "localizedName": "Ossetian", + "direction": "ltr" + }, + "pa": { + "name": "Panjabi", + "localizedName": "Panjabi", + "direction": "ltr" + }, + "pi": { + "name": "Pali", + "localizedName": "Pali", + "direction": "ltr" + }, + "pl": { + "name": "Polish", + "localizedName": "polski", + "direction": "ltr" + }, + "ps": { + "name": "Pashto", + "localizedName": "Pushto", + "direction": "ltr" + }, + "pt": { + "name": "Portuguese", + "localizedName": "português", + "direction": "ltr" + }, + "pt_BR": { + "name": "Portuguese, Brazil", + "localizedName": "português (Brasil)", + "direction": "ltr" + }, + "qu": { + "name": "Quechua", + "localizedName": "Quechua", + "direction": "ltr" + }, + "rm": { + "name": "Raeto-Romance", + "localizedName": "Raeto-Romance", + "direction": "ltr" + }, + "rn": { + "name": "Kirundi", + "localizedName": "Rundi", + "direction": "ltr" + }, + "ro": { + "name": "Romanian", + "localizedName": "română", + "direction": "ltr" + }, + "ru": { + "name": "Russian", + "localizedName": "русский", + "direction": "ltr" + }, + "rw": { + "name": "Kinyarwanda", + "localizedName": "Kinyarwanda", + "direction": "ltr" + }, + "ry": { + "name": "Rusyn", + "localizedName": "ry", + "direction": "ltr" + }, + "sa": { + "name": "Sanskrit", + "localizedName": "Sanskrit", + "direction": "ltr" + }, + "sc": { + "name": "Sardinian", + "localizedName": "Sardinian", + "direction": "ltr" + }, + "sd": { + "name": "Sindhi", + "localizedName": "Sindhi", + "direction": "ltr" + }, + "se": { + "name": "Northern Sami", + "localizedName": "Northern Sami", + "direction": "ltr" + }, + "sg": { + "name": "Sango", + "localizedName": "Sango", + "direction": "ltr" + }, + "sh": { + "name": "Serbo-Croatian", + "localizedName": "sh", + "direction": "ltr" + }, + "si": { + "name": "Sinhalese", + "localizedName": "Sinhalese", + "direction": "ltr" + }, + "sk": { + "name": "Slovak", + "localizedName": "Slovenčina", + "direction": "ltr" + }, + "sl": { + "name": "Slovenian", + "localizedName": "Slovenščina", + "direction": "ltr" + }, + "sm": { + "name": "Samoan", + "localizedName": "Samoan", + "direction": "ltr" + }, + "sn": { + "name": "Shona", + "localizedName": "Shona", + "direction": "ltr" + }, + "so": { + "name": "Somali", + "localizedName": "Somali", + "direction": "ltr" + }, + "sq": { + "name": "Albanian", + "localizedName": "shqipe", + "direction": "ltr" + }, + "sr": { + "name": "Serbian", + "localizedName": "Српски", + "direction": "ltr" + }, + "ss": { + "name": "Swati", + "localizedName": "Swati", + "direction": "ltr" + }, + "st": { + "name": "Sotho", + "localizedName": "Southern Sotho", + "direction": "ltr" + }, + "su": { + "name": "Sundanese", + "localizedName": "Sundanese", + "direction": "ltr" + }, + "sv": { + "name": "Swedish", + "localizedName": "svenska", + "direction": "ltr" + }, + "sw": { + "name": "Swahili", + "localizedName": "Swahili", + "direction": "ltr" + }, + "ta": { + "name": "Tamil", + "localizedName": "Tamil", + "direction": "ltr" + }, + "te": { + "name": "Telugu", + "localizedName": "Telugu", + "direction": "ltr" + }, + "tg": { + "name": "Tajik", + "localizedName": "Tajik", + "direction": "ltr" + }, + "th": { + "name": "Thai", + "localizedName": "ไทย", + "direction": "ltr" + }, + "ti": { + "name": "Tigrinya", + "localizedName": "Tigrinya", + "direction": "ltr" + }, + "tk": { + "name": "Turkmen", + "localizedName": "Turkmen", + "direction": "ltr" + }, + "tl": { + "name": "Tagalog", + "localizedName": "Tagalog", + "direction": "ltr" + }, + "tn": { + "name": "Tswana", + "localizedName": "Tswana", + "direction": "ltr" + }, + "to": { + "name": "Tonga", + "localizedName": "Tonga", + "direction": "ltr" + }, + "tr": { + "name": "Turkish", + "localizedName": "Türkçe", + "direction": "ltr" + }, + "ts": { + "name": "Tsonga", + "localizedName": "Tsonga", + "direction": "ltr" + }, + "tt": { + "name": "Tatar", + "localizedName": "Tatar", + "direction": "ltr" + }, + "tw": { + "name": "Twi", + "localizedName": "Twi", + "direction": "ltr" + }, + "ty": { + "name": "Tahitian", + "localizedName": "Tahitian", + "direction": "ltr" + }, + "ug": { + "name": "Uighur", + "localizedName": "Uighur", + "direction": "ltr" + }, + "uk": { + "name": "Ukrainian", + "localizedName": "українська", + "direction": "ltr" + }, + "ur": { + "name": "Urdu", + "localizedName": "Urdu", + "direction": "rtl" + }, + "uz": { + "name": "Uzbek", + "localizedName": "Uzbek", + "direction": "ltr" + }, + "ve": { + "name": "Venda", + "localizedName": "Venda", + "direction": "ltr" + }, + "vi": { + "name": "Vietnamese", + "localizedName": "Tiếng Việt", + "direction": "ltr" + }, + "vo": { + "name": "Volapuk", + "localizedName": "Volapük", + "direction": "ltr" + }, + "wa": { + "name": "Walloon", + "localizedName": "Walloon", + "direction": "ltr" + }, + "wo": { + "name": "Wolof", + "localizedName": "Wolof", + "direction": "ltr" + }, + "xh": { + "name": "Xhosa", + "localizedName": "Xhosa", + "direction": "ltr" + }, + "yo": { + "name": "Yoruba", + "localizedName": "Yoruba", + "direction": "ltr" + }, + "za": { + "name": "Zhuang", + "localizedName": "Zhuang", + "direction": "ltr" + }, + "zh_CN": { + "name": "Chinese, Simplified", + "localizedName": "中文 (中国)", + "direction": "ltr" + }, + "zh_HK": { + "name": "Chinese, Hong Kong", + "localizedName": "中文 (香港)", + "direction": "ltr" + }, + "zh_TW": { + "name": "Chinese, Traditional", + "localizedName": "中文 (台灣)", + "direction": "ltr" + }, + "zu": { + "name": "Zulu", + "localizedName": "Zulu", + "direction": "ltr" + } +} \ No newline at end of file Index: js/data/localeInfo.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- js/data/localeInfo.js (revision 0c015c92224318ecf5bcf6fa055398aa8638a792) +++ js/data/localeInfo.js (date 1582837197000) @@ -24,1015 +24,11 @@ /* eslint-env browser, node */ 'use strict'; +const fs = require( 'fs' ); + (function( global ) { - const locales = { - aa: { - name: 'Afar', - localizedName: 'Afar', - direction: 'ltr' - }, - ab: { - name: 'Abkhazian', - localizedName: 'Abkhazian', - direction: 'ltr' - }, - ae: { - name: 'Avestan', - localizedName: 'Avestan', - direction: 'rtl' - }, - af: { - name: 'Afrikaans', - localizedName: 'Afrikaans', - direction: 'ltr' - }, - ak: { - name: 'Akan', - localizedName: 'Akan', - direction: 'ltr' - }, - am: { - name: 'Amharic', - localizedName: 'Amharic', - direction: 'ltr' - }, - an: { - name: 'Aragonese', - localizedName: 'Aragonese', - direction: 'ltr' - }, - ar: { - name: 'Arabic', - localizedName: 'العربية', - direction: 'rtl' - }, - ar_MA: { - name: 'Arabic, Morocco', - localizedName: 'العربية (المغرب)', - direction: 'rtl' - }, - ar_SA: { - name: 'Arabic, Saudi Arabia', - localizedName: 'العربية (السعودية)', - direction: 'rtl' - }, - as: { - name: 'Assamese', - localizedName: 'Assamese', - direction: 'ltr' - }, - av: { - name: 'Avaric', - localizedName: 'Avaric', - direction: 'ltr' - }, - ay: { - name: 'Aymara', - localizedName: 'Aymara', - direction: 'ltr' - }, - az: { - name: 'Azerbaijani', - localizedName: 'Azerbaijani', - direction: 'ltr' - }, - ba: { - name: 'Bashkir', - localizedName: 'Bashkir', - direction: 'ltr' - }, - be: { - name: 'Belarusian', - localizedName: 'беларускі', - direction: 'ltr' - }, - bg: { - name: 'Bulgarian', - localizedName: 'български', - direction: 'ltr' - }, - bh: { - name: 'Bihari', - localizedName: 'Bihari', - direction: 'ltr' - }, - bi: { - name: 'Bislama', - localizedName: 'Bislama', - direction: 'ltr' - }, - bm: { - name: 'Bambara', - localizedName: 'Bambara', - direction: 'ltr' - }, - bn: { - name: 'Bengali', - localizedName: 'Bengali', - direction: 'ltr' - }, - bo: { - name: 'Tibetan', - localizedName: 'Tibetan', - direction: 'ltr' - }, - br: { - name: 'Breton', - localizedName: 'Breton', - direction: 'ltr' - }, - bs: { - name: 'Bosnian', - localizedName: 'Bosnian', - direction: 'ltr' - }, - ca: { - name: 'Catalan', - localizedName: 'català', - direction: 'ltr' - }, - ce: { - name: 'Chechen', - localizedName: 'Chechen', - direction: 'ltr' - }, - ch: { - name: 'Chamorro', - localizedName: 'Chamorro', - direction: 'ltr' - }, - co: { - name: 'Corsican', - localizedName: 'Corsican', - direction: 'ltr' - }, - cr: { - name: 'Cree', - localizedName: 'Cree', - direction: 'ltr' - }, - cs: { - name: 'Czech', - localizedName: 'čeština', - direction: 'ltr' - }, - cu: { - name: 'Church Slavic', - localizedName: 'Church Slavic', - direction: 'ltr' - }, - cv: { - name: 'Chuvash', - localizedName: 'Chuvash', - direction: 'ltr' - }, - cy: { - name: 'Welsh', - localizedName: 'Welsh', - direction: 'ltr' - }, - da: { - name: 'Danish', - localizedName: 'Dansk', - direction: 'ltr' - }, - de: { - name: 'German', - localizedName: 'Deutsch', - direction: 'ltr' - }, - dv: { - name: 'Divehi', - localizedName: 'Divehi', - direction: 'ltr' - }, - dz: { - name: 'Dzongkha', - localizedName: 'Dzongkha', - direction: 'ltr' - }, - ee: { - name: 'Ewe', - localizedName: 'Ewe', - direction: 'ltr' - }, - el: { - name: 'Greek', - localizedName: 'Ελληνικά', - direction: 'ltr' - }, - en: { - name: 'English', - localizedName: 'English', - direction: 'ltr' - }, - en_CA: { - name: 'English, Canada', - localizedName: 'English (Canada)', - direction: 'ltr' - }, - en_GB: { - name: 'English, United Kingdom', - localizedName: 'English (United Kingdom)', - direction: 'ltr' - }, - eo: { - name: 'Esperanto', - localizedName: 'Esperanto', - direction: 'ltr' - }, - es: { - name: 'Spanish', - localizedName: 'español', - direction: 'ltr' - }, - es_CO: { - name: 'Spanish, Colombia', - localizedName: 'español (Colombia)', - direction: 'ltr' - }, - es_CR: { - name: 'Spanish, Costa Rica', - localizedName: 'español (Costa Rica)', - direction: 'ltr' - }, - es_ES: { - name: 'Spanish, Spain', - localizedName: 'español (España)', - direction: 'ltr' - }, - es_MX: { - name: 'Spanish, Mexico', - localizedName: 'español (México)', - direction: 'ltr' - }, - es_PE: { - name: 'Spanish, Peru', - localizedName: 'español (Perú)', - direction: 'ltr' - }, - et: { - name: 'Estonian', - localizedName: 'Eesti', - direction: 'ltr' - }, - eu: { - name: 'Basque', - localizedName: 'Basque', - direction: 'ltr' - }, - fa: { - name: 'Persian', - localizedName: 'Persian', - direction: 'rtl' - }, - ff: { - name: 'Fulah', - localizedName: 'Fulah', - direction: 'ltr' - }, - fi: { - name: 'Finnish', - localizedName: 'suomi', - direction: 'ltr' - }, - fj: { - name: 'Fijian', - localizedName: 'Fijian', - direction: 'ltr' - }, - fo: { - name: 'Faroese', - localizedName: 'Faroese', - direction: 'ltr' - }, - fr: { - name: 'French', - localizedName: 'français', - direction: 'ltr' - }, - fu: { - name: 'Friulian', - localizedName: 'fu', - direction: 'ltr' - }, - fy: { - name: 'Western Frisian', - localizedName: 'Frisian', - direction: 'ltr' - }, - ga: { - name: 'Irish', - localizedName: 'Gaeilge', - direction: 'ltr' - }, - gd: { - name: 'Scottish Gaelic', - localizedName: 'Scottish Gaelic', - direction: 'ltr' - }, - gl: { - name: 'Galician', - localizedName: 'Gallegan', - direction: 'ltr' - }, - gn: { - name: 'Guarani', - localizedName: 'Guarani', - direction: 'ltr' - }, - gu: { - name: 'Gujarati', - localizedName: 'Gujarati', - direction: 'ltr' - }, - gv: { - name: 'Manx', - localizedName: 'Manx', - direction: 'ltr' - }, - ha: { - name: 'Hausa', - localizedName: 'Hausa', - direction: 'ltr' - }, - hi: { - name: 'Hindi', - localizedName: 'हिंदी', - direction: 'ltr' - }, - ho: { - name: 'Hiri Motu', - localizedName: 'Hiri Motu', - direction: 'ltr' - }, - hr: { - name: 'Croatian', - localizedName: 'hrvatski', - direction: 'ltr' - }, - ht: { - name: 'Haitian', - localizedName: 'Haitian', - direction: 'ltr' - }, - hu: { - name: 'Hungarian', - localizedName: 'magyar', - direction: 'ltr' - }, - hy: { - name: 'Armenian', - localizedName: 'Armenian', - direction: 'ltr' - }, - hz: { - name: 'Herero', - localizedName: 'Herero', - direction: 'ltr' - }, - ia: { - name: 'Interlingua', - localizedName: 'Interlingua', - direction: 'ltr' - }, - ie: { - name: 'Interlingue', - localizedName: 'Interlingue', - direction: 'ltr' - }, - ig: { - name: 'Igbo', - localizedName: 'Igbo', - direction: 'ltr' - }, - ii: { - name: 'Sichuan Yi', - localizedName: 'Sichuan Yi', - direction: 'ltr' - }, - ik: { - name: 'Inupiaq', - localizedName: 'Inupiaq', - direction: 'ltr' - }, - in: { - name: 'Indonesian', - localizedName: 'Bahasa Indonesia', - direction: 'ltr' - }, - io: { - name: 'Ido', - localizedName: 'Ido', - direction: 'ltr' - }, - is: { - name: 'Icelandic', - localizedName: 'íslenska', - direction: 'ltr' - }, - it: { - name: 'Italian', - localizedName: 'italiano', - direction: 'ltr' - }, - iu: { - name: 'Inuktitut', - localizedName: 'Inuktitut', - direction: 'ltr' - }, - iw: { - name: 'Hebrew', - localizedName: 'עברית', - direction: 'rtl' - }, - ja: { - name: 'Japanese', - localizedName: '日本語', - direction: 'ltr' - }, - ji: { - name: 'Yiddish', - localizedName: 'Yiddish', - direction: 'ltr' - }, - jv: { - name: 'Javanese', - localizedName: 'Javanese', - direction: 'ltr' - }, - ka: { - name: 'Georgian', - localizedName: 'Georgian', - direction: 'ltr' - }, - kg: { - name: 'Kongo', - localizedName: 'Kongo', - direction: 'ltr' - }, - ki: { - name: 'Kikuyu', - localizedName: 'Kikuyu', - direction: 'ltr' - }, - kj: { - name: 'Kwanyama', - localizedName: 'Kwanyama', - direction: 'ltr' - }, - kk: { - name: 'Kazakh', - localizedName: 'Kazakh', - direction: 'ltr' - }, - kl: { - name: 'Kalaallisut', - localizedName: 'Greenlandic', - direction: 'ltr' - }, - km: { - name: 'Khmer', - localizedName: 'Khmer', - direction: 'ltr' - }, - kn: { - name: 'Kannada', - localizedName: 'Kannada', - direction: 'ltr' - }, - ko: { - name: 'Korean', - localizedName: '한국어', - direction: 'ltr' - }, - kr: { - name: 'Kanuri', - localizedName: 'Kanuri', - direction: 'ltr' - }, - ks: { - name: 'Kashmiri', - localizedName: 'Kashmiri', - direction: 'ltr' - }, - ku: { - name: 'Kurdish', - localizedName: 'Kurdish', - direction: 'ltr' - }, - ku_TR: { - name: 'Kurdish, Turkey', - localizedName: 'Kurdish (Turkey)', - direction: 'ltr' - }, - kv: { - name: 'Komi', - localizedName: 'Komi', - direction: 'ltr' - }, - kw: { - name: 'Cornish', - localizedName: 'Cornish', - direction: 'ltr' - }, - ky: { - name: 'Kirghiz', - localizedName: 'Kirghiz', - direction: 'ltr' - }, - la: { - name: 'Latin', - localizedName: 'Latin', - direction: 'ltr' - }, - lb: { - name: 'Luxembourgish', - localizedName: 'Luxembourgish', - direction: 'ltr' - }, - lg: { - name: 'Ganda', - localizedName: 'Ganda', - direction: 'ltr' - }, - li: { - name: 'Limburgish', - localizedName: 'Limburgish', - direction: 'ltr' - }, - lk: { - name: 'Lakota', - localizedName: 'Lakota', - direction: 'ltr' - }, - ln: { - name: 'Lingala', - localizedName: 'Lingala', - direction: 'ltr' - }, - lo: { - name: 'Lao', - localizedName: 'Lao', - direction: 'ltr' - }, - lt: { - name: 'Lithuanian', - localizedName: 'Lietuvių', - direction: 'ltr' - }, - lu: { - name: 'Luba-Katanga', - localizedName: 'Luba-Katanga', - direction: 'ltr' - }, - lv: { - name: 'Latvian', - localizedName: 'Latviešu', - direction: 'ltr' - }, - mg: { - name: 'Malagasy', - localizedName: 'Malagasy', - direction: 'ltr' - }, - mh: { - name: 'Marshallese', - localizedName: 'Marshallese', - direction: 'ltr' - }, - mi: { - name: 'Maori', - localizedName: 'Maori', - direction: 'ltr' - }, - mk: { - name: 'Macedonian', - localizedName: 'македонски', - direction: 'ltr' - }, - ml: { - name: 'Malayalam', - localizedName: 'Malayalam', - direction: 'ltr' - }, - mn: { - name: 'Mongolian', - localizedName: 'Mongolian', - direction: 'ltr' - }, - mo: { - name: 'Moldavian', - localizedName: 'Moldavian', - direction: 'ltr' - }, - mr: { - name: 'Marathi', - localizedName: 'Marathi', - direction: 'ltr' - }, - ms: { - name: 'Malay', - localizedName: 'Bahasa Melayu', - direction: 'ltr' - }, - mt: { - name: 'Maltese', - localizedName: 'Malti', - direction: 'ltr' - }, - my: { - name: 'Burmese', - localizedName: 'Burmese', - direction: 'ltr' - }, - na: { - name: 'Nauru', - localizedName: 'Nauru', - direction: 'ltr' - }, - nb: { - name: 'Norwegian Bokmal', - localizedName: 'Norwegian Bokmål', - direction: 'ltr' - }, - nd: { - name: 'North Ndebele', - localizedName: 'North Ndebele', - direction: 'ltr' - }, - ne: { - name: 'Nepali', - localizedName: 'Nepali', - direction: 'ltr' - }, - ng: { - name: 'Ndonga', - localizedName: 'Ndonga', - direction: 'ltr' - }, - nl: { - name: 'Dutch', - localizedName: 'Nederlands', - direction: 'ltr' - }, - nn: { - name: 'Norwegian Nynorsk', - localizedName: 'Norwegian Nynorsk', - direction: 'ltr' - }, - nr: { - name: 'South Ndebele', - localizedName: 'South Ndebele', - direction: 'ltr' - }, - nv: { - name: 'Navajo', - localizedName: 'Navajo', - direction: 'ltr' - }, - ny: { - name: 'Chichewa', - localizedName: 'Nyanja', - direction: 'ltr' - }, - oc: { - name: 'Occitan', - localizedName: 'Occitan', - direction: 'ltr' - }, - oj: { - name: 'Ojibwa', - localizedName: 'Ojibwa', - direction: 'ltr' - }, - om: { - name: 'Oromo', - localizedName: 'Oromo', - direction: 'ltr' - }, - or: { - name: 'Oriya', - localizedName: 'Oriya', - direction: 'ltr' - }, - os: { - name: 'Ossetian', - localizedName: 'Ossetian', - direction: 'ltr' - }, - pa: { - name: 'Panjabi', - localizedName: 'Panjabi', - direction: 'ltr' - }, - pi: { - name: 'Pali', - localizedName: 'Pali', - direction: 'ltr' - }, - pl: { - name: 'Polish', - localizedName: 'polski', - direction: 'ltr' - }, - ps: { - name: 'Pashto', - localizedName: 'Pushto', - direction: 'ltr' - }, - pt: { - name: 'Portuguese', - localizedName: 'português', - direction: 'ltr' - }, - pt_BR: { - name: 'Portuguese, Brazil', - localizedName: 'português (Brasil)', - direction: 'ltr' - }, - qu: { - name: 'Quechua', - localizedName: 'Quechua', - direction: 'ltr' - }, - rm: { - name: 'Raeto-Romance', - localizedName: 'Raeto-Romance', - direction: 'ltr' - }, - rn: { - name: 'Kirundi', - localizedName: 'Rundi', - direction: 'ltr' - }, - ro: { - name: 'Romanian', - localizedName: 'română', - direction: 'ltr' - }, - ru: { - name: 'Russian', - localizedName: 'русский', - direction: 'ltr' - }, - rw: { - name: 'Kinyarwanda', - localizedName: 'Kinyarwanda', - direction: 'ltr' - }, - ry: { - name: 'Rusyn', - localizedName: 'ry', - direction: 'ltr' - }, - sa: { - name: 'Sanskrit', - localizedName: 'Sanskrit', - direction: 'ltr' - }, - sc: { - name: 'Sardinian', - localizedName: 'Sardinian', - direction: 'ltr' - }, - sd: { - name: 'Sindhi', - localizedName: 'Sindhi', - direction: 'ltr' - }, - se: { - name: 'Northern Sami', - localizedName: 'Northern Sami', - direction: 'ltr' - }, - sg: { - name: 'Sango', - localizedName: 'Sango', - direction: 'ltr' - }, - sh: { - name: 'Serbo-Croatian', - localizedName: 'sh', - direction: 'ltr' - }, - si: { - name: 'Sinhalese', - localizedName: 'Sinhalese', - direction: 'ltr' - }, - sk: { - name: 'Slovak', - localizedName: 'Slovenčina', - direction: 'ltr' - }, - sl: { - name: 'Slovenian', - localizedName: 'Slovenščina', - direction: 'ltr' - }, - sm: { - name: 'Samoan', - localizedName: 'Samoan', - direction: 'ltr' - }, - sn: { - name: 'Shona', - localizedName: 'Shona', - direction: 'ltr' - }, - so: { - name: 'Somali', - localizedName: 'Somali', - direction: 'ltr' - }, - sq: { - name: 'Albanian', - localizedName: 'shqipe', - direction: 'ltr' - }, - sr: { - name: 'Serbian', - localizedName: 'Српски', - direction: 'ltr' - }, - ss: { - name: 'Swati', - localizedName: 'Swati', - direction: 'ltr' - }, - st: { - name: 'Sotho', - localizedName: 'Southern Sotho', - direction: 'ltr' - }, - su: { - name: 'Sundanese', - localizedName: 'Sundanese', - direction: 'ltr' - }, - sv: { - name: 'Swedish', - localizedName: 'svenska', - direction: 'ltr' - }, - sw: { - name: 'Swahili', - localizedName: 'Swahili', - direction: 'ltr' - }, - ta: { - name: 'Tamil', - localizedName: 'Tamil', - direction: 'ltr' - }, - te: { - name: 'Telugu', - localizedName: 'Telugu', - direction: 'ltr' - }, - tg: { - name: 'Tajik', - localizedName: 'Tajik', - direction: 'ltr' - }, - th: { - name: 'Thai', - localizedName: 'ไทย', - direction: 'ltr' - }, - ti: { - name: 'Tigrinya', - localizedName: 'Tigrinya', - direction: 'ltr' - }, - tk: { - name: 'Turkmen', - localizedName: 'Turkmen', - direction: 'ltr' - }, - tl: { - name: 'Tagalog', - localizedName: 'Tagalog', - direction: 'ltr' - }, - tn: { - name: 'Tswana', - localizedName: 'Tswana', - direction: 'ltr' - }, - to: { - name: 'Tonga', - localizedName: 'Tonga', - direction: 'ltr' - }, - tr: { - name: 'Turkish', - localizedName: 'Türkçe', - direction: 'ltr' - }, - ts: { - name: 'Tsonga', - localizedName: 'Tsonga', - direction: 'ltr' - }, - tt: { - name: 'Tatar', - localizedName: 'Tatar', - direction: 'ltr' - }, - tw: { - name: 'Twi', - localizedName: 'Twi', - direction: 'ltr' - }, - ty: { - name: 'Tahitian', - localizedName: 'Tahitian', - direction: 'ltr' - }, - ug: { - name: 'Uighur', - localizedName: 'Uighur', - direction: 'ltr' - }, - uk: { - name: 'Ukrainian', - localizedName: 'українська', - direction: 'ltr' - }, - ur: { - name: 'Urdu', - localizedName: 'Urdu', - direction: 'rtl' - }, - uz: { - name: 'Uzbek', - localizedName: 'Uzbek', - direction: 'ltr' - }, - ve: { - name: 'Venda', - localizedName: 'Venda', - direction: 'ltr' - }, - vi: { - name: 'Vietnamese', - localizedName: 'Tiếng Việt', - direction: 'ltr' - }, - vo: { - name: 'Volapuk', - localizedName: 'Volapük', - direction: 'ltr' - }, - wa: { - name: 'Walloon', - localizedName: 'Walloon', - direction: 'ltr' - }, - wo: { - name: 'Wolof', - localizedName: 'Wolof', - direction: 'ltr' - }, - xh: { - name: 'Xhosa', - localizedName: 'Xhosa', - direction: 'ltr' - }, - yo: { - name: 'Yoruba', - localizedName: 'Yoruba', - direction: 'ltr' - }, - za: { - name: 'Zhuang', - localizedName: 'Zhuang', - direction: 'ltr' - }, - zh_CN: { - name: 'Chinese, Simplified', - localizedName: '中文 (中国)', - direction: 'ltr' - }, - zh_HK: { - name: 'Chinese, Hong Kong', - localizedName: '中文 (香港)', - direction: 'ltr' - }, - zh_TW: { - name: 'Chinese, Traditional', - localizedName: '中文 (台灣)', - direction: 'ltr' - }, - zu: { - name: 'Zulu', - localizedName: 'Zulu', - direction: 'ltr' - } - }; + const locales = JSON.parse( fs.readFileSync( '../../data/localeInfo.json' ).toString() ); // browser require.js-compatible definition global.define && global.define( function() { ```
mattpen commented 4 years ago

@jbphet @Denz1994 - If this went through, you could replace the module parsing in rosetta/js/localeInfo.js with a simple JSON.parse statement.

Denz1994 commented 4 years ago

The installer-builder-config.json field pathToLocaleInfo would need to be updated on Bayes, but otherwise, this seems fine. I'll remain assigned so I can update the config, when ready.

jbphet commented 4 years ago

It would be fine with me to do this, and I agree that it would simplify Rosetta's usage of this file. Both files - the .js and the .json files should exist for a while to allow me to modify Rosetta, test it, and then deploy. Once that's done, the old .js one can be deleted (as far as I'm concerned).

mattpen commented 4 years ago

I'll proceed with this change. First I'll add the json file, then when subsequent chagnes are complete I'll push the chagnes to the js file.

mattpen commented 4 years ago

@Denz1994 @jonathanolson @jbphet - /data/localeInfo.json is now available in master. Please make any adaptations if needed, remove your assignment, and if you are the last one reassign me to make the final change (changing localeInfo.js to a wrapper of the json).

mattpen commented 4 years ago

Bumping priority down, as now that the json exists I can proceed with website-meteor work.

jbphet commented 4 years ago

The work on Rosetta is complete and the js version of the file can be deleted from chipper (as far as Rosetta is concerned - translation might be another matter).

mattpen commented 4 years ago

the js version of the file can be deleted from chipper (as far as Rosetta is concerned - translation might be another matter)

I think the js version is still needed, but I'll change it to be a wrapper for the json file once everyone has confirmed.

jonathanolson commented 4 years ago

I see installer-builder and yotta are still using the JS file. JSON conversion looks good.

Denz1994 commented 4 years ago

The installer builder has been changed to use JSON.

mattpen commented 3 years ago

After reviewing usage in yotta's aggregate.html, converting the js file to use the json as a source isn't trivial. I assumed that we could use the node fs api to retrieve the file, but yotta needs to fetch this data from a browser. We can either (a) use the github raw api to fetch the file via http request in localeInfo.js (using a library that is compatible with node AND browsers) or (b) modify aggregate.html or aggregate.js, along with yotta-server.js to use the json file instead.

IMO (b) seems like the cleanest way to go, but I'd like @jonathanolson's input since that involves yotta changes.

mattpen commented 3 years ago

Bumping priority down as this list isn't likely to change soon, so we can keep using the current solution (maintain 2 nearly identical files) for now.

jonathanolson commented 3 years ago

Option (b) seems fine to me.