Add new isoLangs and change isoLangs generation
- Add new isoLangs to src/js/common.js.
- Generated isoLangs now only have the first nativeName entry defined in
tools/langs/isoLangs.json (for instance, instead of "euskara, euskera"
now the generated nativeName only includes "euskara").
- In the options page, the languages in the select element when adding a
new language are ordered by language name. This change was needed
because now the generated isoLangs variable is ordered by key and not
by name.
Change-Id: Ic0c528b2e0382341700e2ac96cc61186471fe508
diff --git a/tools/langs/langs.go b/tools/langs/langs.go
index c1bbe90..acfb811 100644
--- a/tools/langs/langs.go
+++ b/tools/langs/langs.go
@@ -7,6 +7,7 @@
"log"
"net/http"
"os"
+ "strings"
)
const isoLangsFileName = "isoLangs.json"
@@ -21,6 +22,12 @@
for currLangCode, currLang := range isoLangs {
if currLangCode == lang {
currLang.CodeName = lang
+
+ // Only consider the first entry of the list (e.g. "a, b, c" --> "a")
+ if index := strings.Index(currLang.NativeName, ","); index > 0 {
+ currLang.NativeName = currLang.NativeName[:index]
+ }
+
return currLang, nil
}
}