Page MenuHomePhabricator

Wikisource Extension: Sidebar links have wrong lang parameter for zh-min-nan.wikisource.org
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

Using the sidebar links to export from https://zh-min-nan.wikisource.org returns Page not found for: <page>.

This is because the lang parameter the link uses is nan, when it should be zh-min-nan.

I wonder if there are other circumstances where the wiki's language code is different from the wiki's subdomain. I have not found any others.

Steps to reproduce problem
  1. Go to https://zh-min-nan.wikisource.org/wiki/S%C3%BA-t%C3%B4%CD%98_S%C3%ACn-keng
  2. Click "Download EPUB"

Expected behavior: Takes you to url https://wsexport.wmflabs.org/?lang=zh-min-nan&page=S%C3%BA-t%C3%B4%CD%98_S%C3%ACn-keng&format=epub-3&fonts= and downloads ebook.
Observed behavior: The url is https://wsexport.wmflabs.org/?format=epub-3&lang=nan&page=S%C3%BA-t%C3%B4%CD%98_S%C3%ACn-keng, returns error.

Environment

Wiki(s): Wikisource – (0c0e97a) 2021-nî 1-goe̍h 11-ji̍t (It) 07:36.

Visual example of error encountered:

Acceptance Criteria

Event Timeline

I wonder if there are other circumstances where the wiki's language code is different from the wiki's subdomain. I have not found any others.

According to Wikidata, it looks like it is the only one (other than Multilingual Wikisource).

We talked in the engineering meeting last week about adding a new subdomain request parameter, so the actual URL can be constructed, but given that it's only one I wonder if it's easier to just manually handle this single case? The downside of that is that the generated books would contain xml:lang="zh-min-nan" instead of xml:lang="nan" (i.e. not a valid language code; this is already the case for everything exported from Multilingual Wikisource).

Here's a PR for the simple fix: https://github.com/wsexport/tool/pull/323

The WSExport tool now automatically treats lang=nan as lang=zh-min-nan.

For example, if you go to https://wsexport-test.wmflabs.org/?lang=nan&title=S%C3%BA-t%C3%B4%CD%98_S%C3%ACn-keng you will see the "Language code" input change.

This also means that, once the change is on production, the links on https://zh-min-nan.wikisource.org will work. I have verified this by copying those links and changing the URL to wsexport-test.

Test Environment: wsexport-test version 2.2.3-2-g5e82731.

ifried added a subscriber: ifried.

This is now on production, and the EPUB is now properly generating for https://zh-min-nan.wikisource.org/wiki/S%C3%BA-t%C3%B4%CD%98_S%C3%ACn-keng. For this reason, I'm marking this work as Done.