Closed nyurik closed 3 years ago
I'm pretty sure we don't use #if
in any messages in MediaWiki and extensions either. I'm also pretty sure that it's not core wikitext, but a part of the ParserFunctions extension. Given these two things, I'm pretty sure it's not supposed to be in banana. By my general intuition as a localizer, I'd also try to avoid adding more syntax that translators will have to deal with: $1, PLURAL, and GENDER are already hard enough for a lot of people.
What do you need it for? Can the condition be in the code? Also, if it's something numeric, then perhaps you can do {{PLURAL:$1|1=something|2=something else}}
. People do it in messages sometimes, but it's hacky, so don't stuff beans up your nose :)
I have seen it in MediaWiki core translations, e.g. https://github.com/wikimedia/mediawiki/blob/master/languages/i18n/uk.json#L3399
As for the usecase -- I would like to have an optional
parameter, e.g. if the parameter is given, the text includes it with some extras (like quotes). For an example, see all edit summaries here. Simplified English text looks like this:
Copying $1 changes by $2{{#if:$3|: "$3"}} from $4
The 3rd parameter is optional, and if given, it shows up as : "$3"
Note that this might be a none issue -- I can work around it, so if not desired, I'll close it.
I am more inclined to not to add this feature. As the frontend development patterns are moving towards declarative styles using templating system, this will be redundant conditional rendering.
Agree, i don't think this library should do wiki markup parsing. Which relates to my point in #37 -- I don't think [[...]]
should be parsed either -- as they are part of the wiki parsing and not translation. Closing, thanks for all the feedback!
Banana does not seem to support
{{#if:$1|: \"$1\"}}
and other simple template constructs, making it incompatible with the MW-based localization. Is that by default, or just hasn't been implemented yet?