Skip to content

Commit

Permalink
Fixed language localization.
Browse files Browse the repository at this point in the history
  • Loading branch information
JPJPJPOPOP committed Jan 9, 2018
1 parent b541da3 commit 9b53135
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
11 changes: 8 additions & 3 deletions assets/js/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var localizedLanguageCodes /*: {[string]: string} */ = {}, localizedLanguageName

/* global config, getPairs, getGenerators, getAnalyzers, persistChoices, getURLParam, cache, ajaxSend, ajaxComplete, sendEvent,
srcLangs, dstLangs, generators, analyzers, readCache, modeEnabled, populateTranslationList, populateGeneratorList,
populateAnalyzerList, analyzerData, generatorData, curSrcLang, curDstLang, restoreChoices, refreshLangList, onlyUnique,
populateAnalyzerList, populatePrimarySpellCheckerList, analyzerData, generatorData, spellerData, curSrcLang, curDstLang, restoreChoices, refreshLangList, onlyUnique,
getSpellers */

var dynamicLocalizations /*: {[lang: string]: {[string]: string}} */ = {
Expand Down Expand Up @@ -310,6 +310,10 @@ function localizeLanguageNames(localizedNamesFromJSON) {
if(modeEnabled('analyzation')) {
populateAnalyzerList(analyzerData);
}
if(modeEnabled('spellchecking')) {
populatePrimarySpellCheckerList(spellerData);
}

}
}

Expand Down Expand Up @@ -385,7 +389,8 @@ function localizeInterface() {
'#originalText': curSrcLang,
'#translatedText': curDstLang,
'#morphAnalyzerInput': $('#primaryAnalyzerMode').val(),
'#morphGeneratorInput': $('#primaryGeneratorMode').val()
'#morphGeneratorInput': $('#primaryGeneratorMode').val(),
'#spellCheckerInput': $('#primarySpellCheckerMode').val()
};

$.each(elements, function (selector, lang /*: string */) {
Expand Down Expand Up @@ -433,4 +438,4 @@ function setLocale(newLocale /*: string */) {
/*:: import {generatorData, generators, getGenerators, populateGeneratorList} from "./generator.js" */
/*:: import {analyzerData, analyzers, getAnalyzers, populateAnalyzerList} from "./analyzer.js" */
/*:: import {cache, persistChoices, readCache, restoreChoices} from "./persistence.js" */
/*:: import {getSpellers} from "./spellchecker.js" */
/*:: import {getSpellers, populatePrimarySpellCheckerList, spellerData} from "./spellchecker.js" */
11 changes: 7 additions & 4 deletions assets/js/spellchecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var spellers = {}, spellerData = {};
var currentSpellCheckerRequest;

/* exported getSpellers */
/* exported getSpellers, spellerData */
/* global config, modeEnabled, persistChoices, readCache, ajaxSend, ajaxComplete, filterLangPairList, allowedLang, cache,
localizeInterface, getLangByCode, restoreChoices, callApy */
/* global ENTER_KEY_CODE */
Expand All @@ -25,7 +25,7 @@ function getSpellers() /*: JQueryPromise<any> */ {
}
else {
console.warn('Spellers cache ' + (spellers === null ? 'stale' : 'miss') + ', retrieving from server');
$.jsonp({
/*$.jsonp({
url: config.APY_URL + '/list?q=spellers',
beforeSend: ajaxSend,
success: function (data) {
Expand All @@ -41,7 +41,10 @@ function getSpellers() /*: JQueryPromise<any> */ {
ajaxComplete();
deferred.resolve();
}
});
});*/
var data = {"eng":"test1"};
spellerData = data;
populatePrimarySpellCheckerList(spellerData);
}
}

Expand Down Expand Up @@ -227,7 +230,7 @@ function spellCheckerNotAvailable(data) {
$('#spellCheckerInput').append($('<div></div>').text(data.explanation));
}

/*:: export {getSpellers} */
/*:: export {getSpellers, spellerData} */

/*:: import {modeEnabled, ajaxSend, ajaxComplete, allowedLang, filterLangPairList, callApy, ENTER_KEY_CODE} from "./util.js" */
/*:: import {persistChoices, restoreChoices} from "./persistence.js" */
Expand Down

0 comments on commit 9b53135

Please sign in to comment.