Page MenuHomePhabricator

action=searchtranslations should suggest where to find values for message groups and language codes
Closed, ResolvedPublic2 Estimated Story Points

Description

language

    The language code to search string for. 
    Default: (empty)
group

    The group ID to search string in. 
    Default: (empty)

It should be possible to use ParamValidator::PARAM_TYPE to set it to a list of language/group codes?

I guess sourcelanguage could be similarly limited too.

Event Timeline

There are hundreds of languages (language, sourcelanguage), and on Meta, over 15,000 groups. I don’t think listing all those would make the help page more usable. main:uselang doesn’t list all possible languages either. However, more information on how to find out the list of possible values could be helpful.

Yeah it would be bad for performance. Likely so even if they are cached when we reach over 10k values.

Maybe for performance as well, but not only: if I have to scroll over 15k group names, I feelingly never reach the end of the page, which makes it less helpful for humans.

Nikerabbit moved this task from Backlog to TTMServer on the MediaWiki-extensions-Translate board.

Declining unless someone figures out way to solve the performance and UI issues.

However, more information on how to find out the list of possible values could be helpful.

Doing this part would make sense at least though...

For groups we can point to meta=messagegroups. For languages I don't know, there probably isn't API for it.

Change 1008013 had a related patch set uploaded (by Nikerabbit; author: Nikerabbit):

[mediawiki/extensions/Translate@master] Improve API doc

https://gerrit.wikimedia.org/r/1008013

Nikerabbit set the point value for this task to 2.Mar 4 2024, 1:01 PM
Reedy renamed this task from action=searchtranslations should list values for groups and language codes to action=searchtranslations should suggest where to find values for message groups and language codes.Mar 4 2024, 2:39 PM

For languages I don't know, there probably isn't API for it.

We currently do:

	"apihelp-main-param-uselang": "Language to use for message translations. <kbd>[[Special:ApiHelp/query+siteinfo|action=query&meta=siteinfo]]</kbd> with <kbd>siprop=languages</kbd> returns a list of language codes, or specify <kbd>user</kbd> to use the current user's language preference, or specify <kbd>content</kbd> to use this wiki's content language.",
	"apihelp-main-param-errorlang": "Language to use for warnings and errors. <kbd>[[Special:ApiHelp/query+siteinfo|action=query&meta=siteinfo]]</kbd> with <kbd>siprop=languages</kbd> returns a list of language codes, or specify <kbd>content</kbd> to use this wiki's content language, or specify <kbd>uselang</kbd> to use the same value as the <var>uselang</var> parameter.",

I don't know why we don't actually link that one properly, I think I'll fix that...

I'm guessing this might not be all encompassing for the languages that MediaWiki-extensions-Translate/translatewiki.net support though?

Yeah the list of translatable languages is a bit different from UI languages (and furthermore it can also very per group).

So really, we probably need an API module in Translate, that is optionally filtered by the group ID to give the list...

Change 1008013 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Improve API doc

https://gerrit.wikimedia.org/r/1008013

image.png (1×2 px, 160 KB)

Done for param messagegroups. Nothing to point for languages (suggesting separate task for that if wanted).