Topics

I18N - LocoNet Simulator

Alain LM
 

Hi All,

First of all, Happy New Year - my first message of the year.

I'm currently updating the French translation of JMRI (almost lagging 2 years of development) and adding some I18N where missing.

I have 2 issues with I18N of LocoNet Simulator:

1. I cannot locate string 'LocoNet Simulator' that is displayed as the menu name in the menu bar of PanelPro; maybe hard-coded or built with two sub-strings. 'Simulator' should be localized (and by the way in French and other languages, the two words should be swapped).

2. file java/src/jmri/jmrix/loconet/hexfile/ConnectionConfig.java
Current: return "LocoNet Simulator"; // NOI18N
Proposed Change: return Bundle.getMessage("TitleLocoNetSimulator");

I tested the change, it works at first glance, with the text properly being displayed (localized) on the PanelPro main window when using the LocoNet Simulator.
I'm however curious about the comment // NOI18N. Is this an imperative DON'T localize or does it mean not localized yet, as a reminder.
I have not tested thoroughly, so I cannot tell what this change may have broken, if it has.

Any suggestion welcome.
--
Alain LM

Paul Bender
 




On Jan 1, 2019, at 11:15 AM, Alain LM <AlanUS.forum@...> wrote:
1. I cannot locate string 'LocoNet Simulator' that is displayed as the menu name in the menu bar of PanelPro; maybe hard-coded or built with two sub-strings. 'Simulator' should be localized (and by the way in French and other languages, the two words should be swapped).

It should come from the memo’s system name ( see the constructor in https://github.com/JMRI/JMRI/blob/master/java/src/jmri/jmrix/loconet/swing/LocoNetMenu.java )

2. file java/src/jmri/jmrix/loconet/hexfile/ConnectionConfig.java
Current: return "LocoNet Simulator"; // NOI18N
Proposed Change: return Bundle.getMessage("TitleLocoNetSimulator");

I tested the change, it works at first glance, with the text properly being displayed (localized) on the PanelPro main window when using the LocoNet Simulator.
I'm however curious about the comment // NOI18N. Is this an imperative DON'T localize or does it mean not localized yet, as a reminder.

I think in this particular case, the NOI18N is an error, but generally it does mean this line should not be translated.

Paul

Alain LM
 

For 1. I think that the menu title is programmatically built, probably depending on the type of LocoNet connection. I leave it for know as I cannot find for sure where this happens.
For 2. OK, let's go for the proposed change, then.
--
Alain LM

Alain LM
 

For 2. - actually that was an imperative DON'T localize.

See comment from @devel-bobm on this commit:

If I recall correctly, the name() method of the ConnectionConfig class returns a name which is used within the configuration profile. Changing this line to an "internationalized" name could therefore cause difficulty for anyone with an existing configuration profile specifying this connection type who moves from an older JMRI version to a version based on this code. That failure-mode should be avoided! If that recollection is accurate, it justifies the use of // NOI18N in the original code for this method, and justifies modification to include // NOI18N in this method for ConnectionConfig code for other connection types.
--
Alain LM