Maps
Maps copied to clipboard
i18n: The message "maps-geo-json-create-page-button" should be in page view language or user language instead of content language
Setup
- Maps version: 7.20.1
- MW version: 1.33.3 (upgrading to 1.37.2; see announcements from Fandom)
- PHP version: 7.3.33 (fpm-fcgi)
- SMW version (if applicable): none
Issue
Detailed description of the issue and a stack trace if applicable:
/src/GeoJsonPages/GeoJsonNewPageUi.php
:
wfMessage( 'maps-geo-json-create-page-button' )->inContentLanguage()->text()
Steps to reproduce the observation (recommendation is to use the sandbox):
- Go to any wiki using language with language variants
- Example: https://ucptest.fandom.com/zh/wiki/ using language
zh
withzh, zh-hans, zh-hant, zh-cn, zh-hk, zh-mo, zh-myy, zh-sg, zh-tw
variants.
- Example: https://ucptest.fandom.com/zh/wiki/ using language
- Select
zh-hant
,zh-tw
,zh-hk
orzh-mo
as the variant ("page view language" aka "user language variant", see Manual:Language )- Example: https://ucptest.fandom.com/zh/wiki/GeoJson:T?variant=zh-tw
- Current behavior: using
/zh
translation for the "Create this page" button - Expected behavior: using
/zh-tw
translation for the "Create this page" button
Related files:
/psalm-baseline.xml
/src/GeoJsonPages/GeoJsonNewPageUi.php
Solutions:
- Using page view language: replace
->inContentLanguage()
, using->inLanguage( $lang )
with page view language as the variable passed to the method instead. - Using user language: simply remove
->inContentLanguage()
.
Thanks.
If you are able and willing to provide a PR, that is definitely welcome.
I'm having issues in wfMessage( 'maps-loading-map' )->inContentLanguage()->text()
in /src/GeoJsonPages/GeoJsonMapPageUi.php
and /src/Map/MapHtmlBuilder.php
as the function doesn't privide any information about the page language.
Should I just use user interface language then?
CC @JeroenDeDauw
(Anyway, I'll use "user interface language" as it should let us prevent further technical issues and tech debts.)
GitHub pull request #695