Page MenuHomePhabricator

Improve language input for maps in VE
Open, Needs TriagePublic3 Estimated Story Points

Description

Requirements

  • Change language code input to ComboBoxInputWidget (filtering on input). Remove existing text input and button.
  • To populate the combobox options, re-use data from one of the many choose language from list throughout wiki (most likely the current pop-up accessed by the ... button)
  • Combobox should preselect the default language
  • Keep current behavior: nothing about language is passed to the wikitext unless the user selects something other than the default
  • Section label remains Language

Nice to have:

  • Format of dropdown options: Language name - Language code (ex. English - en)
  • include local as an option in the dropdown - the label should be: local (use language local to each map area)
Mock and specs

See epic: T318834

Technical implementation

Goes into the attribute <mapframe lang="…"> (don’t forget the special case “local”)
We can reuse the existing list of languages in the "..." dialog.

Result

Screenshot from 2022-11-01 14-20-31.png (1×1 px, 146 KB)

Related Objects

Event Timeline

lilients_WMDE set the point value for this task to 3.Sep 28 2022, 2:34 PM
Esanders added a subscriber: Esanders.

(screenshot file not attached)

  • Placeholder text Default: Language of wiki

@ECohen_WMDE Currently the code actually reads the default language of the wiki and selects it from the list. Should we keep that behaviour or would you prefer removing it and displaying the placeholder?

Oh looks like it is a bit more complicated. This is what is happening now:

	getDefaultLanguage: function () {
		return mw.config.get( 'wgKartographerUsePageLanguage' ) ?
			mw.config.get( 'wgPageContentLanguage' ) :
			'local';
	}

Updates the task based on our conversation, will also update the help text now in the other ticket to reflect the changes

Change 842755 had a related patch set uploaded (by Svantje Lilienthal; author: Svantje Lilienthal):

[mediawiki/extensions/Kartographer@master] [WIP] Improve language input for maps in VE

https://gerrit.wikimedia.org/r/842755

@ECohen_WMDE In contrast to the existing language search field, the one specified in the ticket is only allowing a prefix search. So depending on how we order the language names and codes you can only search for one of them. Is that what we want or should we maybe look for another solution that allows infix search?

@lilients_WMDE I think if the ordering is with the language name first and code following (as specified), the prefix search is acceptable. Infix search might be more ideal but I don't think it's a reason to choose a different component. I'm guessing there is no option for infix with combobox?

Goes into the attribute <mapframe lang="…"> (don’t forget the special case “local”)

While reviewing the patch, I realized that there's currently no entry for local in the ComboBox. I wonder if we should add an extra option in the dropdown that's either just empty ( because setting nothing falls back to the default local ). Or even add something that matches the local setting with some text like Set language to geo location.

because setting nothing falls back to the default local

I don't think local is the default. It should be the content language of the current wiki, which is why this option is preselected. So I wouldn't add any empty option.

Good point! I considered adding it to the list, but then thought that since it's a combobox, they can simply write in local if they like. I also thought it might be unclear without more context. I like the idea of adding extra text though and including it would make it clear that it's an 'official' option and make it more discoverable.

I would add it to the bottom of the list (though if they start to write it, it would show up from the filter). I think it should still include the term local though in case people are already familiar with it. Maybe local (use language of map area)?

To clarify though: I think this is a nice to have. I've added it to the help text, so if this doesn't work for some reason, then the option to use local is still covered in some way.

The more I look at this feature, the more skeptical I am that anyone wants to set a specific language. The default (page/wiki content language) is correct for most uses, and the only other valid use case I can imagine is that an editor wants to display labels in the "local" language. Do we have any examples where lang= is used to set the map to show a third language? Generally we go to great lengths to never show "untranslated" (non-content-language) text to readers.

I think we could replace this whole thing by a single checkbox for "show in local / regional language". Perhaps the "..." button and dialog was an intentional design choice, meant to hide the field from unnecessary setting?

Also, if we do show the language combo box, I think that language code search is necessary. This is after all the value that will go into the wikitext.

I found a good way to query for lang= usages: insource:mapframe insource:/ lang=/. Using this, I found only a scant handful of actual lang attributes, and they seem to all be misusages which can be better expressed by "lang=local":
https://en.wikipedia.org/wiki/Ko%C5%A1evi
https://en.wikipedia.org/wiki/Daur_railway_station
https://en.wikipedia.org/wiki/Munich_East_station
https://en.wikipedia.org/wiki/Lucerne_railway_station

Also, I disagree with the decision to use the local labels but that's not really my business (meaning, I'm not responsible for editing and maintaining this content).

Fisch made the great suggestion to add a configured mode in which all maps appear with labels in both the content language and the local language, together.

Change 842755 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Improve language input for maps in VE

https://gerrit.wikimedia.org/r/842755

Change 849482 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] Allow the long language drop-down to utilize the entire dialog

https://gerrit.wikimedia.org/r/849482

Change 849490 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] Use "substring" filter to allow searching for language codes

https://gerrit.wikimedia.org/r/849490

Change 850174 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/Kartographer@master] Add `local` option for the VE language selection

https://gerrit.wikimedia.org/r/850174

Regression: when the text in the language input field is cleared, * the dialog save button isn't enabled, and * the page is somehow corrupted and cannot be saved. Error displayed: "⧼The specified revision is deleted or suppressed.⧽"

UPDATE: seems to be unrelated to our work.

Change 850174 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Add `local` option for the VE language selection

https://gerrit.wikimedia.org/r/850174

Change 849482 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/extensions/Kartographer@master] Allow the long language drop-down to utilize the entire dialog

Reason:

Not strictly needed any more

https://gerrit.wikimedia.org/r/849482

Change 850447 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] Replace hard-coded brackets with dash in language drop down

https://gerrit.wikimedia.org/r/850447

Change 849490 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/extensions/Kartographer@master] Use "substring" filter to allow searching for language codes

Reason:

Partly done in I2a8e715 now.

https://gerrit.wikimedia.org/r/849490

Change 850447 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Replace hard-coded brackets with dash in language drop down

https://gerrit.wikimedia.org/r/850447

Follow up: "local" gets translated, which is incorrect because the option only works if the exact English keyword is entered. Change the text to:

Use language local to each map area — <tvar name="code">local</tvar>

"local" as a keyword should be included in a way that makes it untranslateable.

Change 855000 had a related patch set uploaded (by Svantje Lilienthal; author: Svantje Lilienthal):

[mediawiki/extensions/Kartographer@master] Making sure local does not get translated

https://gerrit.wikimedia.org/r/855000

Change 855000 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Making sure local does not get translated

https://gerrit.wikimedia.org/r/855000