← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~dholbach/help-app/1456929 into lp:help-app

 

Daniel Holbach has proposed merging lp:~dholbach/help-app/1456929 into lp:help-app.

Commit message:
change language specifiers like 'de-DE' into 'de'

Requested reviews:
  Ubuntu Help app developers (help-app-dev)
Related bugs:
  Bug #1456929 in Ubuntu Help App: "Translations don't show up on the phone"
  https://bugs.launchpad.net/help-app/+bug/1456929

For more details, see:
https://code.launchpad.net/~dholbach/help-app/1456929/+merge/260920

change language specifiers like 'de-DE' into 'de'
-- 
Your team Ubuntu Help app developers is requested to review the proposed merge of lp:~dholbach/help-app/1456929 into lp:help-app.
=== modified file 'static/index.html'
--- static/index.html	2015-03-19 13:22:42 +0000
+++ static/index.html	2015-06-03 10:13:42 +0000
@@ -79,14 +79,16 @@
             UI.init();
 
             var language = navigator.language || navigator.userLanguage;
+	    // Now we turn "de-DE" into "de".
+	    var langCode = language.slice(0, language.indexOf("-"));
             console.log("Language: " + language);
 
             // Check if there are translations available for the language
             // if not, fall back to en-us
             $.ajax({
-                url: "index." + language + ".html",
+                url: "index." + langCode + ".html",
                   error: function(data){
-                      console.log("No translations for " + language + " available. Fall back to en-us.")
+                      console.log("No translations for " + langCode + " available. Fall back to en-us.")
                     language = "en-us";
                   },
                   async: false
@@ -102,7 +104,7 @@
                     tabTitle,
                     tabTextNoHeader;
 
-                $.get(tabId + "." + language + ".html", function (response) {
+                $.get(tabId + "." + langCode + ".html", function (response) {
                     // This is asynchronous, so make sure
                     // any operations with tab content are done within
                     // this function.


Follow ups