On Fri, Dec 9, 2011 at 10:17, Denis Gervalle <dgl(a)softec.lu> wrote:
Hi Devs,
I am looking at now using the new Locale added in DocumentReference into
the implementation of XWikiDocument.
I have already deprecated language related stuff in XWikiDocument, and I
have introduce a XWikiDocument#getLocale and an XWikiDocument#isTranslation
helper since the deprecation of defaultLanguage will increase the need of
it. I have also added XWikiDocument#getTranslatedDocument() with Locale in
place of language. All the changes are almost backward compatible, which is
nice (there is some subtleties with default, "" and null that is now more
equivalent, but should not have consequences).
The is however one change that is not backward compatible, which is the
change of the document reference. Therefore,
XWikiDocument#getDocumentReference does not return the same reference than
it does before, because this reference now contains the Locale. This cause
breakage in several places. I see some option to fix this:
A. Fix all places broken. This may be too long for me, and not trivial.
B. Introduce a new XWikiDocument#getDocumentReferenceWithLocale() and
have XWikiDocument#getDocumentRefence() returns without Locale. Very easy,
but not nice.
C. Introduce a new XWikiDocument#getDocumentReferenceWithoutLocale() and
change all existing calls to XWikiDocument#getDocumentRefence() in platform
to use this one. Nicer, but this is not fully backward compatible.
Since I am on it right now, I would appreciate your opinion quickly.
WDYT ?
I am undecided between B and C
Well after more thinking, there is no simple rules and B is not fully safe
in some places. So I am more in favor of C, since it is the cleanest on the
long term. I am also thinking to implement a cache of the reference without
local for better efficiency.
Please give me your comment asap, especially if you strongly disagree on C
since I will start coding this.
--
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO
--
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO