Template talk:Fallback

From Wikimedia Commons, the free media repository
Jump to: navigation, search

This template only functions with the namespace Template. So when I make my own page in my user namespace e.g. User:Michiel1972/Credit/nl together with User:Michiel1972/Credit/layout this will never result in the language nl but only in /en. Can this be changed for more namespaces.. Michiel1972

Try {{SuperFallback}}. Jean-Fred (talk) 21:58, 28 April 2012 (UTC)

Lua version[edit]

I have created a Module:Fallback that I think should eventually replace Template:Fallback, Template:GetFallback, Template:Fallback2, Template:LangSwitch, and potentially a few others. Having a Lua version is more convenient if we want to call it from other modules, and I think the new version makes the fallback chain easier to read than the curent one that as it is not split into 2 pages. It should also allow to easily create longer fallback chains if needed.

The main problem I see is that the module removes the dashes from language names in order to make them Lua table-keys. That is "en-gb" is transformed into "engb" by the module. That may make things a bit unwieldy and buggy when called from other modules. That also limits the efficiency gains, especially when many languages are provided. From what I have tested the loading time of {{LangSwitch/sandbox}} is between 20% and 100% of that of {{LangSwitch}}, depending on the content. Beside, I am not sure that the code is extremely readable, if someone has any idea on how to improve that... If you agrees, I think we could first replace {{LangSwitch}} with {{LangSwitch/sandbox}}, and then try to make use of this module in other templates as well so that we do not need to keep both a module and a template version. -Zolo (talk) 16:49, 20 November 2013 (UTC)

Actually, I found how toadd dashes in the keys, so all is well. When fallback is used, rendering time seems to be divided by about. --Zolo (talk) 16:30, 21 November 2013 (UTC)

Lastly, it was added in MediaWiki an access to the fallback sequence used internally by MediaWiki (gerrit:101910). I worked today to integrate it in the meta:Module:Template translation, so it could be used by Template:TNT, Template:Fallback and other forms of translation/auto-translation (like that). I compared the lists of GetFallback/GetFallback2 and the MediaWiki built-in one, I post it in some minutes in another section on this page. ~ Seb35 [^_^] 16:55, 18 January 2014 (UTC)

Comparison of the fallback sequences between {{Fallback}} and MediaWiki[edit]

> In MediaWiki, but
not in {{Fallback}}

< In {{Fallback}}, but
not in MediaWiki


> ab = ru
> ace = id
> aeb = ar
< af = nl
> aln = sq
< als = de
> an = es
> anp = hi
> arn = es
> av = ru
> ay = es
> azb = fa
> ba = ru
> bbc = bbc-latn
> bbc-latn = id
> bcc = fa
> be-tarask = be
< be-x-old = be-tarask
> bh = bho
> bjn = id
> bm = fr
> bpy = bn
> bqi = fa
< br = fr
> bug = id
> bxr = ru
> cbk-zam = es
> cdo = nan, zh-hant
> ce = ru
< ckb = fa
< co = fr
> co = it
> crh = crh-latn (*)
> crh-cyrl = ru
< crh-cyrl = crh (*)
< crh-latn = crh (*)
> cv = ru
> dsb = de
> dtp = ms
> egl = it
> eml = it
< en-gb = en
> ff = fr
> fit = fi
> frc = fr
> fur = it
< fy = nl
> gag = tr
> gan = gan-hant, zh-hant, zh-hans
> gan-hans = zh-hans
> gan-hant = zh-hant, zh-hans
> gl = pt
> gn = es
> gsw = de
> hak = zh-hant
> hif = hif-latn (*)
< hif-deva = hif (*)
< hif-latn = hif (*)
> hsb = de
> ii = zh-cn, zh-hans
< ike-cans = ike (*)
< ike-latn = ike (*)
> inh = ru
> iu = ike-cans
> jut = da
> jv = id
> kaa = kk-latn, kk-cyrl
> kbd = kbd-cyrl
> khw = ur
> kiu = tr
> kk = kk-cyrl (*)
> kk-arab = kk-cyrl (*)
< kk-arab = kk (*)
> kk-cn = kk-arab, kk-cyrl (*)
< kk-cn = kk (*)
< kk-cyrl = kk (*)
> kk-kz = kk-cyrl (*)
< kk-kz = kk (*)
> kk-latn = kk-cyrl (*)
< kk-latn = kk (*)
> kk-tr = kk-latn, kk-cyrl (*)
< kk-tr = kk (*)
> kl = da
> koi = ru
> ko-kp = ko
> krc = ru
> ks = ks-arab
> ku = ku-latn (*)
> ku-arab = ckb
< ku-arab = ku (*)
< ku-latn = ku (*)
> kv = ru
> lad = es
> lb = de
> lbe = ru
> lez = ru
> lij = it
> liv = et
> lmo = it
> ln = fr
> ltg = lv
> lzz = tr
> mai = hi
> map-bms = jv, id
> mhr = ru
> min = id
> mo = ro
> mrj = ru
> mwl = pt
> myv = ru
> nah = es
> nan = cdo, zh-hant
> nap = it
> nds = de
< nds = nds-nl, de
> nds-nl = nl
< nds-nl = nds, nl
> os = ru
> pcd = fr
> pdc = de
> pdt = de
< pdt = nds, de
> pfl = de
> pms = it
> pt = pt-br
> qu = es
> qug = qu, es
> rgn = it
> rmy = ro
> rue = uk, ru
> ruq = ruq-latn, ro
> ruq-cyrl = mk
< ruq-cyrl = ruq (*)
< ruq-grek = ruq (*)
> ruq-latn = ro
< ruq-latn = ruq (*)
> sa = hi
> sah = ru
> scn = it
> sg = fr
> sgs = lt
> sli = de
< sr-ec = sr (*)
< sr-el = sr (*)
> srn = nl
> sr = sr-ec
> stq = de
> su = id
> tcy = kn
> tg = tg-cyrl (*)
< tg-cyrl = tg (*)
< tg-latn = tg (*)
> tt = tt-cyrl, ru
> tt-cyrl = ru
< tt-cyrl = tt (*)
< tt-latn = tt (*)
> tyv = ru
> udm = ru
> ug = ug-arab
> uk = ru
> vep = et
> vmf = de
> vot = fi
> vro = et
> wo = fr
> wuu = zh-hans
> xal = ru
> xmf = ka
> yi = he
> za = zh-hans
> zh-cn = zh-hans
< zh-cn = zh-hans, zh (*)
< zh-hans = zh (*)
> zh-hant = zh-hans
< zh-hant = zh (*)
> zh-hk = zh-hant, zh-hans
< zh-hk = zh-hant, zh (*)
> zh-mo = zh-hk, zh-hant, zh-hans
< zh-mo = zh-hant, zh (*)
> zh-my = zh-sg, zh-hans
< zh-my = zh-hans, zh (*)
> zh-sg = zh-hans
< zh-sg = zh-hans, zh (*)
> zh-tw = zh-hant, zh-hans
< zh-tw = zh-hant, zh (*)

> In MediaWiki, but
not in Module:Fallbacklist

< In Module:Fallbacklist, but
not in MediaWiki


> aeb = ar
< af = nl
< als = gsw, de
> azb = fa
< bat-smg = sgs, lt
> bbc = bbc-latn
> bbc-latn = id
> be-tarask = be
< be-tarask = ru
< be-x-old = be-tarask
< br = fr
> bxr = ru
> cdo = nan, zh-hant
< ckb = fa
> co = it
< co = fr
< crh-cyrl = crh
< crh-latn = crh
< en-gb = en
< fio-vro = vro
< fy = nl
> gan = gan-hant, zh-hant, zh-hans
< gan = gan-hant, zh-hant
> gan-hant = zh-hant, zh-hans
< gan-hant = zh-hant
> gsw = de
> hak = zh-hant
< hif-deva = hif
< hif-latn = hif
> ii = zh-cn, zh-hans
< ii = zh-cn
< ike-cans = ik
< ike-latn = ik
> kk-arab = kk-cyrl
< kk-arab = kk-cyrl, kk
> kk-cn = kk-arab, kk-cyrl
< kk-cn = kk-arab, kk-cyrl, kk
< kk-cyrl = kk
> kk-kz = kk-cyrl
< kk-kz = kk, kk-cyrl
> kk-latn = kk-cyrl
< kk-latn = kk
> kk-tr = kk-latn, kk-cyrl
< kk-tr = kk-latn, kk
> ku-arab = ckb
< ku-arab = ckb, ku
< ku-latn = ku
> mai = hi
< may = hi
> nan = cdo, zh-hant
> nds = de
< nds = nds-nl, de
> nds-nl = nl
< nds-nl = nds, nl
< no = nb
> pdt = de
< pdt = nds, de
> pt = pt-br
< roa-rup = rup
> ruq = ruq-latn, ro
< ruq = ruq-latn
< rug-latn = ro, ruq
> ruq-cyrl = mk
< ruq-cyrl = ruq, mk
< ruq-grek = ruq
> ruq-latn = ro
< sr-ec = sr
< sr-el = sr
> srn = nl
< tg-cyrl = tg
< tg-latn = tg
< tt-cyrl = tt
< tt-latn = tt
> tyv = ru
< zh-classical = lzh
< zh-hans = zh-cn, zh
> zh-hant = zh-hans
< zh-hant = zh
> zh-hk = zh-hant, zh-hans
< zh-hk = zh-hant
< zh-min-nan = nan
> zh-mo = zh-hk, zh-hant, zh-hans
< zh-mo = zh-hk, zh-hant
> zh-tw = zh-hant, zh-hans
< zh-tw = zh-hant
< zh-yue = yue

As promised above, here is the comparison between the fallback sequences of {{GetFallback}}/{{GetFallback2}} and MediaWiki’s internal one.

At first sight we can see MediaWiki has more fallbacks (166 vs 65) and the main differences are in the language variants where the logics are opposite: Commons generalise the language from variants to general language (and translations can use the language converter in MediaWiki) but MediaWiki specialise the language from the general language to the variant (so the variants use the more specialized system messages, often because the language uses multiple scripts). Variants of zh are in all cases generalized to zh-hans and/or zh-hant, but Commons generalized it again with zh. I tried to mark with an asterisk the opposite behaviours between MediaWiki and Commons/Translate extension (i.e. normal differences).

I guess MediaWiki should be added some interesting fallbacks (e.g. af, br, ckb, en-gb, fy, possibly als, be-x-old (or not:)), there are some conflicting fallbacks (co=fr|it; nds; pdt), and the differences in the treatment of variants should be resolved perhaps by adding (or by computing automatically) reverse fallback sequences dedicated to the translation fallbacks.

~ Seb35 [^_^] 13:49, 19 January 2014 (UTC)

I added the comparison between Module:Fallbacklist and MediaWiki. Module:Fallbacklist is more complete (has 184 fallback sequences) than {{Fallback}} and the differences with MediaWiki are mainly the variants. ~ Seb35 [^_^] 16:43, 19 January 2014 (UTC)