Forum > Translations

[SOLVED] LCLTranslator: update of current form possible?

(1/3) > >>

howardpc:
I'm developing an app where the opening dialog has a combo with a drop-down offering various language translations.
Picking one of the drop-down offerings calls

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---LCLTranslator.SetDefaultLang(lang);where "lang" is picked up from the selected language,
and the subsequent forms and dialogs are all duly translated correctly.

Is it possible for the current dialog - the one with the language selection combo - also to be updated and its texts rewritten in the just-selected language?

Sieben:
Assuming that the dialog inherites from TCustomForm you can try:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- LCLTranslator.UpdateTranslation(MyDialog);

howardpc:
I presume you mean
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---with TDefaultTranslator.Create(moFile) do    UpdateTranslation(MyDialog);however, I had already tried that, and it has no apparent effect, though it compiles and runs without error.

Sieben:
Sorry, yes, should have been LRSTranslator instead of LCLTranslator. Had another look at SetDefaultlang() and it should call UpdateTranslation() anyway for all Screen.CustomForms as ForceUpdate defaults to True. Doesn't work? I've never really tried so far, I have to admit.

howardpc:
Well it works fine for all the forms not yet showing, but does not affect the current one for some reason, even if I call Invalidate immediately afterwards.

Navigation

[0] Message Index

[#] Next page

Go to full version