Skip to content

Support captions language codes from Weblate #7754

Description

@nicorikken

Describe the problem to be solved

I'm working on subtitles generated from translations on Weblate of the Ada & Zangemann book. Currently I'm working on a script to automatically upload the captions for the different subtitle languages.

All subtitles have the language codes from Weblate. I like this format because it aligns with ISO-639 and supports macrolanguages and is even extendable to support multiple editions in the same languages using BCP47. That could be a way to upload multiple subtitles per language.

When trying to upload the subtitles generated from the current Weblate translations of Ada & Zangemann I run into three issues at the moment.

Language Weblate code PeerTube expected code
Portuguese (Portugal) pt_PT pt-PT
Portuguese (Brazilian) pt_BR pt
Alemannic gsw_FR Not available
Chinese (Simplified Han script zh_Hans zh-Hans

In general Weblate seems to support more languages, as it has a long list of defined languages and supports a fallback for other languages.

There is an API endpoint to request registered languages, but the list is limited in general and the assigning pt to mean Portuguese (Brazilian) as default seems ambiguous if not confusing.

There are currently 800 languages registered in Weblate plus it supports custom extension. In PeerTube 8.2.4 I count only 206 and this list cannot be extended.

Describe the solution you would like

I would like PeerTube to:

  • Accept pt_PT and zh_Hans with underscores instead of dashes as valid input as equivalent to pt-PT, so be more liberal about the accepted language codes. So that language codes of Weblate can be placed into PeerTube directly.
  • Accept pt_BR as valid language code instead of requiring ambiguous pt which by the ISO standard can mean both Portuguese (Brazilian) or Portuguese (Portugal).
  • Accept gsw_FR as valid language, by adding more language definitions or by permitting custom definitions.

From an API-perspective it could be challenging to upload with one language code and then have to query it with another, so I would expect the language codes to behave like aliases in order to make this work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions