Background information
We would like to dynamically change the survey title based on project domain. If the project is a Wikipedia project we would like to also include the URL of said project, here's an example
In the last 30 days, have you felt unsafe or uncomfortable contributing to Wikipedia (en.wikipedia.org)?
If the project is a non-wikipedia project we would like to omit the URL, here's an example
In the last 30 days, have you felt unsafe or uncomfortable contributing to Wikimedia Commons?
With a combination of Magic Words and Parsers Functions we are able to dynamically change the question based on the {{SITENAME}} with the following code
In the last 30 days, have you felt unsafe or uncomfortable contributing to {{SITENAME}}{{#ifeq: Wikipedia | {{SITENAME}} | <nowiki> </nowiki>({{SERVERNAME}})}}?
but unfortunately this method isn't working for Wikipedias that set their site name in a non-latin alphabet, if there are diacritics (eg. Portuguese Wikipedia is "Wikipédia") and if grammatical case changes for the word Wikipedia (for example in Polish "Wikipedii" is a possibility) - anything where the exact output isn't "Wikipedia". For example @TAndic tested this on Serbian Wikipedia and the output does not include the {{SERVERNAME}} as intended
In the last 30 days, have you felt unsafe or uncomfortable contributing to Википедија?
Questions
- Is it possible to have a message where:
- Wikipedia projects show {{SITENAME}} ({{SERVERNAME}})
- Non Wikipedia projects show {{SITENAME}} (Commons, Wikidata, Mediawiki, etc.)
- If so, how?
Answer: Yes it is possible, by specifically listing the wikis where you want {{SITENAME}} only, and defaulting the rest of wikis to {{SITENAME}} ({{SERVERNAME}}) like this:
{{SITENAME}}{{#switch: {{SITENAME}} | Wikimedia Commons | Wikidata | Meta = | #default = <nowiki> </nowiki>({{SERVERNAME}})}}
Examples:
- https://meta.wikimedia.org/wiki/User:JHernandez_(WMF)/sandbox/safety-survey-question-test
- https://commons.wikimedia.org/wiki/User:JHernandez_(WMF)/sandbox/safety-survey-question-test
- https://www.wikidata.org/wiki/User:JHernandez_(WMF)/sandbox/safety-survey-question-test
- https://en.wikipedia.org/wiki/User:JHernandez_(WMF)/sandbox/safety-survey-question-test
- https://fr.wikipedia.org/wiki/Utilisateur:JHernandez_(WMF)/sandbox/safety-survey-question-test