Forum > Translations
[Solved] Translation of ResourceString
jcmontherock:
I have the following definitions in an application using the translation:
--- 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";}};} ---ResourceString rReload = 'File:' + #13 + '%s + #13 + has been changed by another application.' + #13 + 'Should I reload it from disk ?';....I use it in:
--- 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";}};} ---rc := Application.MessageBox(PChar(Format(rReload, [sPoFileName])), PChar(rFileChanged), MB_YESNO or MB_ICONQUESTION); The result of this entry in the pot, po file is:
--- 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";}};} ---#: editpou.rreload#, object-pascal-formatmsgid """File:\n""%s \n”“has been changed by another application.\n""Should I reload it from disk ?"msgstr "" The line "#, object-pascal-format" was added and the original string is not in the "msgid" param. Several help applications for input translation do not recognize this entry in po file.
What should I do ?
wp:
--- Quote from: jcmontherock on September 28, 2025, 06:18:47 pm ---
--- 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";}};} ---ResourceString rReload = 'File:' + #13 + '%s + #13 + has been changed by another application.' + #13 + 'Should I reload it from disk ?';....
--- 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";}};} ---#: editpou.rreload...
--- End quote ---
Why are there two r's in the line "#:editpou.rreload"? In my own projects, the pot/po file has in the '#:' lines the name of the resourcestring unit, a dot and the name of the resourcestring. Therefore I would expect to see "#:editpou.reload". Maybe delete (or rename) the pot/po files and recreate them by "Project" > "Resave forms with enabled i18n".
H₂SO₄:
The "#, object-pascal-format" line seems to be added whenever a format specifier is detected in the string (here it's %s).
It's a special comment that might be used by some programs for providing better diagnostics, but shouldn't affect compatibility otherwise.
I'd be more concerned about the single carriage return line endings (not used by any major platform - it's either #10 or #13#10, but never #13 alone). Are you targeting the Commodore 64, the ZX-Spectrum or another retro machine?
Also, are you aware that you (most likely) forgot two quotes around the second #13?
--- 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";}};} ---'File:'+#13+'%s + #13 + has been changed by another application.'+#13+'Should I reload it from disk ?'
Why are those special quote characters there?
"%s \n”
“has been changed by another application.\n"
” U+201D Right Double Quotation Mark
“ U+201C Left Double Quotation Mark
Thaddy:
--- Quote from: Khrys on September 29, 2025, 07:39:33 am ---I'd be more concerned about the single carriage return line endings (not used by any major platform - it's either #10 or #13#10, but never #13 alone). Are you targeting
--- End quote ---
Don't forget classic mac and Apple 11 and TRS80
jcmontherock:
@wp: there are 2 "r" because it's the name of the string: rReload.
- My problem seems to be in the original string: text is out of msgid param.
- destination is Windows 11.
Navigation
[0] Message Index
[#] Next page