-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When translations not loaded yet, return empty string.
- Loading branch information
1 parent
a7390a6
commit 9e32559
Showing
5 changed files
with
27 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -709,28 +709,30 @@ angular.module('idai.components') | |
"translation/jsonp?application=arachne4_frontend&lang={LANG}&callback=JSON_CALLBACK"; | ||
|
||
|
||
|
||
var translationLang=ENGLISH_LANG; | ||
var translationsLoaded = false; | ||
var translations={}; // Map: [transl8_key,translation]. | ||
|
||
|
||
if (primaryBrowserLanguage.browserPrimaryLanguage()=='de') translationLang='de'; | ||
var transl8Url = TRANSL8_JSONP_URL.replace('{LANG}',translationLang); | ||
|
||
|
||
|
||
var translations={}; // Map: [transl8_key,translation]. | ||
$http.jsonp(transl8Url). | ||
success(function(data) { | ||
|
||
for(var i = 0; i < data.length; i++) { | ||
translations[data[i].key] = data[i].value; | ||
} | ||
translationsLoaded=true; | ||
}). | ||
error(function() { | ||
alert("ERROR: Could not get translations. Try to reload the page or send a mail to [email protected]"); | ||
}); | ||
|
||
return { | ||
|
||
getTranslation: function(key) { | ||
if (!translationsLoaded) return ''; | ||
|
||
var translation = translations[key]; | ||
if (!translation || 0 === translation.length) | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,28 +15,30 @@ angular.module('idai.components') | |
"translation/jsonp?application=arachne4_frontend&lang={LANG}&callback=JSON_CALLBACK"; | ||
|
||
|
||
|
||
var translationLang=ENGLISH_LANG; | ||
var translationsLoaded = false; | ||
var translations={}; // Map: [transl8_key,translation]. | ||
|
||
|
||
if (primaryBrowserLanguage.browserPrimaryLanguage()=='de') translationLang='de'; | ||
var transl8Url = TRANSL8_JSONP_URL.replace('{LANG}',translationLang); | ||
|
||
|
||
|
||
var translations={}; // Map: [transl8_key,translation]. | ||
$http.jsonp(transl8Url). | ||
success(function(data) { | ||
|
||
for(var i = 0; i < data.length; i++) { | ||
translations[data[i].key] = data[i].value; | ||
} | ||
translationsLoaded=true; | ||
}). | ||
error(function() { | ||
alert("ERROR: Could not get translations. Try to reload the page or send a mail to [email protected]"); | ||
}); | ||
|
||
return { | ||
|
||
getTranslation: function(key) { | ||
if (!translationsLoaded) return ''; | ||
|
||
var translation = translations[key]; | ||
if (!translation || 0 === translation.length) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters