On 08/20/2012 04:55 PM, Vincent Massol wrote:
On Aug 4, 2012, at 4:37 AM, Sergiu Dumitriu wrote:
Hi devs,
Trying to address
http://jira.xwiki.org/browse/XWIKI-6228 I noticed today a big problem
with the way translations work.
$xwiki.getDocument('Main.Welcome').getTranslatedDocument('fr').plainTitle
No matter what language I request, the title will always be displayed in English. This is
caused by the fact that for all translations, the title is actually
$msg.get("xe.dashboard.wiki.welcome"), and $msg uses the context language, not
the document language. This means that getting the right title of the document is almost
impossible.
Given that we've separated the displayers from the oldcore and the main rendering
engine, we could change their behavior so that document translations would work better.
Whenever displaying some information from a document, we should temporarily change the
context language to be the same as the document's language, if any. This would be a
backwards-incompatible change, but IMO it's a change for the better.
Can you give examples of things that will break for our users?
I can't think of any. IMO using a l10n bundle in a language other than
that of the document is wrong, but perhaps some users will be baffled to
see search results in a "different" language. For example, using a
search query that returns all the different versions of the Main.Welcome
message, currently baffles users by the fact that the same document
appears many times; will it baffle them to suddenly see results in
Swedish, Lithuanian, Russian, Chinese and so on, in a wiki that they
though was only in their language?
That particular problem will be addressed in the future, though, since
by default we'll just show results in the current language.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/