Am 25.03.2016 um 22:56 schrieb Lydia Pintscher:
On Thu, Mar 24, 2016 at 10:55 PM Platonides
<platonides(a)gmail.com
<mailto:platonides@gmail.com>> wrote:
Will it be possible to force a property to be loaded in a given language
(typically English)? I'm thinking in usages that embed the property into
Category names, internal comparisons in a template…
Yes that is possible via loading the whole item in Lua. Then you have access to
everything including labels in all languages.
While this is true, let me add that
* the preferred way to access labels is to ask for either the content language
or the user language.
* you would not benefit from the built in language fallback mechanism. If there
is no label in your desired language, you are on your own.
* using labels to create links is a bad idea.
* internal comparisons should be based on ids rather than labels. Labels are not
reliable keys for matching datasets. If labels are needed, i suggest doing this
in the content language (which, for commons, is "en").
* Accessing the full data structure via lua is expensive - it needs to load the
entire item and transform it to a lua data structure. Also, we have to track
this kind of access as "anything might have been used", which flags the page
for
purging every time anything about the item changes.
So yes, it's possible, but not recommended in general. Please let us know about
important use cases for accessing labels in a specific language, so we can think
about optimizing for such use cases specifically.
--
Daniel Kinzler
Senior Software Developer
Wikimedia Deutschland
Gesellschaft zur Förderung Freien Wissens e.V.