Open dankurka opened 9 years ago
I don't think this has anything to do with UiBinder -- UiBinder generates a Messages
subtype that has the source in annotations, and the issue you are hitting is that LocalizableResourceGenerator
isn't consulting a properties file for the default locale preferentially over those
annotations.
Reported by jat@google.com
on 2011-01-05 02:00:31
Accepted
I ran into the same problem and I think it is unexpected behavior.
The UiBinder should overwrite its annotations with those from a default properties
file, if existing.
Reported by robert.hoffmann.phd
on 2012-06-14 09:10:56
I don't think so. If you don't want to provide a @DefaultMessage (to fallback to using
a properties file), then I think you should use a <ui:msg> without content.
This however is not allowed currently.
(and I must say I disagree with John's analysis that properties files should override
annotations; but maybe I misunderstood)
Reported by t.broyer
on 2012-06-14 10:25:34
If we agree on the golden goal to separate competencies and logic from representation,
then we probably agree that it should be possible to manage textual appearance (in
general not just i18n) by writers or translators (‘texter’), without having to change
code or UiBinder xml. Also one would want only one place where texters get involved
(e.g. property files).
If one uses this as a guiding principle then the actual content of message annotations
in UiBinder is something that the user of an application should ideally never get to
see, because these messages are raw and not supervised by the texter.
This then identifies the purpose of message annotations in UiBinder as ‘natural language
variables/keys’. Indeed it seems a recommended practice to generate md5 keys (ui:generateKeys)
from these in annotations. https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinderI18n
Also from a consistency point of view. Why should LocalizableResource_XX.properties
be able to overwrite the in-UIBinder annotations, but LocalizableResource_default.properties
not?
I think the hierarchy should be
1) Use in-UiBinder annotations
2) Replace them, if the texter provides an alternative (i.e. via properties files).
Be it for a specific language or the default language (which might also be refined
over time independently from the xml).
Reported by robert.hoffmann.phd
on 2012-06-14 12:17:11
You can have the exact same reasoning about annotations in Constants or Messages itnerfaces,
so really UiBinder has nothing to do with the issue (besides currently forcing you
to generate these annotations).
Given your use case / organization, then I tend to agree with John that properties
files should override annotations, but this should probably be configurable (using
a <configuration-property>, defaulting to the current behavior of using annotations
over properties files).
Reported by t.broyer
on 2012-06-14 13:21:22
Exactly, doesn't the annotatin in UiBinder correspond to @defaultmessage in the Messages
interface? But this default annotation in Messages can indeed be overwritten by both
the LocalizedResources_LANGUAGE.properties and the LocalizedResources.properties.
Just for uibinder LocalizedResources.properties doesn't overwrite. That's why I meant
that from the Messages mechanism perspective this behavior seems unexpected. Best Robert
Reported by robert.hoffmann.phd
on 2012-06-14 14:21:14
Right, this doesn't really have anything to do with UiBinder. There is an open bug
(which I am unable to find at the moment) about translations in properties files not
overriding the annotations, which was intended so that localization could change them
without modifying the source.
So, the fix would be in the i18n generator's resource lookup instead of UiBinder.
However, that code is getting completely rewritten so this would get fixed as part
of that rewrite.
Reported by jat@google.com
on 2012-06-14 14:48:31
Originally reported on Google Code with ID 5066
Reported by
constantin.tanno
on 2010-06-28 15:29:58