Bug 124060 - Missing accelerator/mnemonic in translated string causes variable name to be rendered instead of its value
Summary: Missing accelerator/mnemonic in translated string causes variable name to be ...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Localization (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All Linux (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-13 15:30 UTC by Buovjaga
Modified: 2020-03-08 13:06 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot of dialog showing the problem (16.82 KB, image/png)
2019-03-13 15:30 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Buovjaga 2019-03-13 15:30:19 UTC
Created attachment 149940 [details]
Screenshot of dialog showing the problem

This was originally a report from IRC concerning the non-ODF format warning/confirmation dialog. Button text showed %FORMATNAME in place of the actual variable value.

In my local repo I went to 
translations/source/fi/sfx2/messages.po

and changed the appropriate block to have a mnemonic like so:

#: alienwarndialog.ui:43
msgctxt "alienwarndialog|save"
msgid "_Use %FORMATNAME Format"
msgstr "_Käytä %FORMATNAME-muotoa"

I updated the .mo file with

msgfmt -o instdir/program/resource/fi/LC_MESSAGES/sfx.mo translations/source/fi/sfx2/messages.po

This made the button text render ok, BUT in a crazy turn of events made the other button display %DEFAULTEXTENSION. The other button was missing the mnemonic as well, so this change made everything fine:

#: alienwarndialog.ui:27
msgctxt "alienwarndialog|cancel"
msgid "Use %DEFAULTEXTENSION _Format"
msgstr "Käytä %DEFAULTEXTENSION-_muotoa"

Next, I tried to cause the same problem in the German translation. Curiously, it was not enough to simply remove the mnemonics. It was only after I changed the word benutzen to blabla that the problem appeared!
Comment 1 Julien Nabet 2019-03-15 14:32:25 UTC
here's the link on Pootle:
https://translations.documentfoundation.org/fi/libo_ui/translate/sfx2/messages.po#search=alienwarndialog&sfields=source,target,notes,locations&soptions=exact&unit=137375004&offset=0

May it be the pb than the variable name is suffixed with another string?
In Unix shell we'd use this %{FORMATNAME}-muotoa but I suppose we can't ask to translators to use such a mechanism.
Comment 2 Buovjaga 2019-03-15 15:53:13 UTC
(In reply to Julien Nabet from comment #1)
> here's the link on Pootle:
> https://translations.documentfoundation.org/fi/libo_ui/translate/sfx2/
> messages.po#search=alienwarndialog&sfields=source,target,notes,
> locations&soptions=exact&unit=137375004&offset=0
> 
> May it be the pb than the variable name is suffixed with another string?
> In Unix shell we'd use this %{FORMATNAME}-muotoa but I suppose we can't ask
> to translators to use such a mechanism.

Nope, it is not related to that. It is only related to the missing mnemonics. Just double-checked by modifying the finnish messages.po and updating .mo file.
Comment 3 Julien Nabet 2019-03-15 16:03:06 UTC
(In reply to Buovjaga from comment #2)
> ...
> Nope, it is not related to that. It is only related to the missing
> mnemonics. Just double-checked by modifying the finnish messages.po and
> updating .mo file.

Oups, you just meant the "_" lacking prefix in translation for shortcut mechanism. If it can help, I can quickly add it on Pootle link I quoted in my previous comment.
Comment 4 Buovjaga 2019-03-15 16:23:31 UTC
(In reply to Julien Nabet from comment #3)
> (In reply to Buovjaga from comment #2)
> > ...
> > Nope, it is not related to that. It is only related to the missing
> > mnemonics. Just double-checked by modifying the finnish messages.po and
> > updating .mo file.
> 
> Oups, you just meant the "_" lacking prefix in translation for shortcut
> mechanism. If it can help, I can quickly add it on Pootle link I quoted in
> my previous comment.

Ok, if you are an admin, you can accept both of my suggestions: https://translations.documentfoundation.org/fi/libo_ui/translate/#filter=suggestions&sort=newest

This report is not about the translation issue, though, but this weird an unexpected behaviour :)
Comment 5 Julien Nabet 2019-03-15 17:38:16 UTC
(In reply to Buovjaga from comment #4)
> ...
> Ok, if you are an admin, you can accept both of my suggestions:
> https://translations.documentfoundation.org/fi/libo_ui/translate/
> #filter=suggestions&sort=newest
>...
Done in master

Remark: I also changed 6.2 part for one of them:
https://translations.documentfoundation.org/fi/libo62_ui/translate/#search=_Use%20%25FORMATNAME%20Format&sfields=source,target
but didn't find the other one (I should have noted both)
Comment 6 Buovjaga 2019-03-15 17:52:29 UTC
(In reply to Julien Nabet from comment #5)
> Done in master
> 
> Remark: I also changed 6.2 part for one of them:
> https://translations.documentfoundation.org/fi/libo62_ui/translate/
> #search=_Use%20%25FORMATNAME%20Format&sfields=source,target
> but didn't find the other one (I should have noted both)

Here it is https://translations.documentfoundation.org/fi/libo62_ui/translate/sfx2/messages.po#unit=160464833
Comment 7 Julien Nabet 2019-03-15 18:04:48 UTC
(In reply to Buovjaga from comment #6)
>...
> Here it is
> https://translations.documentfoundation.org/fi/libo62_ui/translate/sfx2/
> messages.po#unit=160464833

Great! Done too.
Thank you for your quick feedback!
Comment 8 Julien Nabet 2019-09-09 13:57:33 UTC
Following changes in Pootle, any update with a recent LO version?
Comment 9 QA Administrators 2020-03-08 02:50:55 UTC Comment hidden (obsolete)
Comment 10 Buovjaga 2020-03-08 13:06:35 UTC
(In reply to Julien Nabet from comment #8)
> Following changes in Pootle, any update with a recent LO version?

It was not about any string changes, but some problem in the string replacement code.

However, the problem seems to be gone. I tried to sabotage the French translation in the same way as I did with the German one in my description and the problem did not appear.

Arch Linux 64-bit
Version: 7.0.0.0.alpha0+
Build ID: 08334285ec9c7d5356f4b89192a5fba6e6733328
CPU threads: 8; OS: Linux 5.5; UI render: default; VCL: kf5; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 8 March 2020