Page MenuHomePhabricator

Get a list of all languages of a multilingual SVG file in Lua
Closed, ResolvedPublic

Description

When a template or module needs to know about all languages of a multilingual SVG file,
it is necessary to browse somehow the SVG code of that file.
That is done e.g. by the File Description Page on Commons,
or by tools like the Toolforge Translator, each time when the file is accessed,
making sure that the list or table is always at the current state.
But currently a Lua item like "mw.title.getCurrentTitle().langlist" does not yet exist,
displays shown on the description page have to be maintained their parameter list
anytime when something is changed depending the embedded languages, to be up-to-date.
Of course, such a title object needs physical file access and is therefore not cheap,
it must do quite the same as is done when the description page is displayed.

The existing file metadata table includes: width, height, pages, size, mimeType, length, and metadata (i.e. Exif etc.).

Event Timeline

Aklapper renamed this task from Table item needed in Lua to Get a list of all languages of a multilingual SVG file in Lua.Jul 28 2020, 1:36 PM
Aklapper added a project: Scribunto.

This would make it possible for the Commons translate template to automatically add relevant categories, and solve this feature request: T407647: Adding translations with SVG Translate should automatically add the respective language category & other version

I think adding the language list to the file table would make sense, e.g. mw.title.new( 'File:Lorem.svg' ).file.langs.

Change #1307281 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/Scribunto@master] Add Title.file.langs to fetch SVG languages

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

Change #1307281 merged by jenkins-bot:

[mediawiki/extensions/Scribunto@master] Add Title.file.languages to fetch SVG languages

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

Samwilson claimed this task.