Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard-code check for Multilingual Wikisource to avoid errors #470

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

samwilson
Copy link
Member

Rather than looking for an empty subdomain, check for the Wikidata ID of Multilingual Wikisource.

Bug: T342520

Rather than looking for an empty subdomain, check for the Wikidata
ID of Multilingual Wikisource.

Bug: T342520
}
$out[$subdomain] = $datum['label'];
preg_match( '|https://([a-z-_]*)\.?wikisource\.org|', $datum['website'], $matches );
$out[$matches[1]] = $datum['label'];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$matches[1] seems a bit fragile to me if Wikidata data are invalid for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I did initially try it with Wikimedia language code (P424), but that doesn't get the correct value for some, like syl. Although maybe https://www.wikidata.org/wiki/Q120844812 should not be called a Wikisource language edition yet, while it's in incubator.

If someone puts an invalid value for Official website then you're right, this would break, but then whatever we pull from Wikidata could get broken at some point so I'm not sure it's too different.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I have made this disucssion slip. Indeed, that's a good point. I am fine with merging this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants