On Mon, Jun 10, 2013 at 5:37 PM, Vincent Massol
<vincent(a)massol.net> wrote:
On Jun 10, 2013, at 5:11 PM, Vincent Massol <vincent(a)massol.net> wrote:
On Jun 10, 2013, at 5:00 PM, Thomas Mortagne <thomas.mortagne(a)xwiki.com> wrote:
Hi devs,
Right now the XAR plugin format goal systematically empty the
<defaultLanguage> property.
This is wrong IMO since it means we have no idea what is the default
document language, it was not too visible before but it's really not
very nice for things like the localization module and especially SOLR
which store deferently the content depending on the language (stop
words, etc).
I see several possibilities:
1) We don't touch the XAR maven plugin and we state that when default
language is not set, it's en (in the importer for example or in
XWikiDocument#getDefaultLanguage)
2) We stop filtering default language in the XAR plugin and we set it
to en for all document in which it make sense
3) We force default language to "en" in the XAR plugin
WDYT ?
I don't like too much 1) since some technical document could really be
seen has having no default language, some document without any literal
content. But it's more a -0 than a -1, I understand other would want
this for simplicity.
About 3) as I said having a default language empty is a valid use case
IMO so -0 for this one to. Still a bit better than 1) since the use
case is still possible.
3) is ok IMO because this plugin is for our own use case so we control our default
language and I don't think it makes sense to have no default language (even if the
page is only technical with no text we could still mark it as english by default).
Big -1 for 2). The reason I added the filtering was to remove the inconsistencies we had
everywhere. That's our only solution to make sure we don't forget to set it and to
have consistent XML files.
BTW we need to verify that the export feature sets the value correctly too.
So I'm +1 for 1) or 3).
I think I have a small preference for 3) which is more explicit and less magical. If we
support the mode where no default translation is set then 3) seems best to me.
BTW the XAR plugin should also be modified to
clean up both <language> and <defaultLanguage> and it should look at XML file
names to decide if it's cleaning a translation or not.
We need to define the rules. For example for 3):
* Main document (e.g. WebHome.xml):
** make sure <translation> is empty
** set <defaultTranslation> to
"en"
* Translation document (e.g. WebHome.fr.xml):
** make sure <translation> is set to the value from the file name (ie. we extract
"fr" from WebHome.fr.xml)
This is dangerous and useless anyway IMO, someone could want to have a
document with a dot in its name for any reason and I doubt you will
even get a translation with the wrong language in its XML.