DescriptionContent Translation default suggested language calculation.svg
English: Unreviewed analysis of the current behavior of the UniversalLanguageSelector and ContentTranslation extensions.
PlantUML source code:
@startuml
start
split
group mw.uls.getFrequentLanguageList
:ulsFrequentLanguages = [
wgUserLanguage,
wgContentLanguage,
window.navigator.language or window.navigator.userLanguage,
ULS previously used languages,
wgULSAcceptLanguageList or window.navigator.languages,
geolocated country languages,
];
:Clean list to only include
valid and supported languages;
end group
split again
group siteMapper.getLanguagePairs
:{targetLanguages, sourceLanguages} =
get /list/languagepairs from CX service;
end group
end split
group CXDashboard
:filter possible target and source languages
by ulsFrequentLanguages
and filter to targets which are also in sources;
split
if (URL query "to"?) then (yes)
:targetLanguage = query.to;
(no) elseif (stored targetLanguage?) then (yes)
:targetLanguage = stored targetLanguage;
else (no)
endif
if (targetLanguage in targetLanguages) then (no)
:targetLanguage = wgContentLanguage;
else (yes)
endif
split again
if (URL query "from"?) then (yes)
:sourceLanguage = query.from;
(no) elseif (stored sourceLanguage?) then (yes)
:sourceLanguage = stored sourceLanguage;
else (no)
endif
end split
if (sourceLanguage valid?) then (no)
:sourceLanguage = first sourceLanguages != targetLanguage;
else (yes)
endif
if (targetLanguage valid?) then (no)
:targetLanguage = first targetLanguages != sourceLanguage;
else (yes)
endif
:store default source and target language;
end group
stop
@enduml
to share – to copy, distribute and transmit the work
to remix – to adapt the work
Under the following conditions:
attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.