helge17 / tuxguitar

Improve TuxGuitar and provide builds
Other
492 stars 42 forks source link

bug when apostrophe and parameter both present in translated message #468

Closed guiv42 closed 4 months ago

guiv42 commented 4 months ago

TuxGuitar 1.6.3, Linux (openSuse tumbleweed). Bug already present in 1.5.6 When a message translation includes both an apostrophe ' and at least one parameter {0} the displayed string is incorrect. Apostrophe is removed, and sometimes parameter value is not displayed correctly. Example when trying to open an invalid file from collection browser, error message is OK in English and erroneous in French French message is: file.open.error=Impossible d'ouvrir: {0}

english french

in Catalan, same message includes 2 apostrophes, which are not displayed. In this case, value of parameter is displayed correctly.

Root cause: when parameters are present in translated message, java.text.MessageFormat.format() is used to replace parameters by their values, but apostrophe has a specific meaning in this context: https://github.com/helge17/tuxguitar/blob/9348bf609593c5e59eccca8578dcf93a222714b5/common/TuxGuitar-lib/src/org/herac/tuxguitar/util/TGMessagesManager.java#L85