Closed xfq closed 4 years ago
we may not have any additional code for check or debug in the future, but how about to add one function like below for ease of maintenance and modification.
// as replaceHeaders('editors', translations[lang].editors);
function replaceHeaders (target, translated) {
if (document.getElementById(target)) {
document.getElementById(target).textContent = translated;
}
}
Ah, one point. Do we want to add a line for console log output, for telling us about error?
It is indeed a good suggestion. I just refactored the code.
I used console.log
instead of console.error
, because sometimes missing headers may not be considered errors (like previousversion
).
Thanks for the review @himorin. I'll go ahead and merge this.
@r12a feel free to comment on https://github.com/w3c/jlreq/issues/231 or submit a new issue/PR if you have any question/concern/suggestion about this.
@r12a feel free to comment on #231 or submit a new issue/PR if you have any question/concern/suggestion about this.
From a quick scan i don't notice anything problematic. (However, i would have preferred to keep the layout consistent, ie. no ; at line end, and } in line with block end (Python-like layout). That's only a minor thing though.)
Since language switching in ED has been unable to work for a few days now (see #231), I made a pull request to fix this issue first. I suggest that we merge it, and we can continue to improve the code in the future.