Maps icon indicating copy to clipboard operation
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

Open winstonsung opened this issue 2 years ago • 5 comments

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 with zh, zh-hans, zh-hant, zh-cn, zh-hk, zh-mo, zh-myy, zh-sg, zh-tw variants.
  • Select zh-hant, zh-tw, zh-hk or zh-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

winstonsung avatar May 12 '22 05:05 winstonsung

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() .

winstonsung avatar May 12 '22 05:05 winstonsung

Thanks.

If you are able and willing to provide a PR, that is definitely welcome.

JeroenDeDauw avatar May 12 '22 10:05 JeroenDeDauw

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

winstonsung avatar May 13 '22 10:05 winstonsung

(Anyway, I'll use "user interface language" as it should let us prevent further technical issues and tech debts.)

winstonsung avatar May 13 '22 10:05 winstonsung

GitHub pull request #695

winstonsung avatar May 13 '22 10:05 winstonsung