rquinio / l10n-maven-plugin

:abcd: Maven plugin to validate localization resources in Java properties files
MIT License
3 stars 1 forks source link

'_en', '_ja' and the default property files cause false "Resource has identical translation" warnings #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Which version of the plugin are you using?
1.7

This may be more of a question/enhancement request - couldn't find a forum to 
consult first.

I have three flavors of message property files, '_en', '_ja' and the default 
one. The _en and default ones are the same.

Now I get a lot of:
[WARNING] <[site.properties, site_en.properties]><site.n....msg> Resource has 
identical translation in
2 languages, but 1 different value(s) in the other languages 
[site_ja.properties]

The message makes sense, my default and '_en' files are the same and '_ja' has 
different values, but that's the way it should be.

Maybe I have just configured something wrong, but I suppose I'm looking for a 
way to:
- ideally, remove the default property file and get maven to make a copy of the 
'_en' file during the build/package process automatically, so no validation on 
the default file is required.
- or, for there to be a slight variation to this WARNING's check: all values in 
'_en' and the default file should be the same.

Thanks.

Original issue reported on code.google.com by dies...@gmail.com on 21 Mar 2014 at 1:24

GoogleCodeExporter commented 9 years ago
Yeah, I imagine you want to default to English (the default/backup language) in 
case something is not translated in Japanese, which is better than displaying 
nothing :-)

I used to do this defaulting programatically:
1. Get ResourceBundle for current locale (ex: ja) and get the message (will try 
on _ja then root)
2. In case of MissingResourceException, get ResourceBundle for default locale 
and retry (will try on _en then root)
This way the root bundle could remain clean, and simply contain non-language 
dependent stuff.

You might also use an empty _en file, and always default to root.
But your way of doing is definitely valid too.

The current check is: if resource is identical in > 50% of the languages, but 
has at least 1 different value, then warn. 
50% is kind of arbitrary :p So the check could simply be ignored in the limit 
case of 2 languages + root bundle.

Original comment by romain.q...@gmail.com on 7 Jul 2014 at 10:35