MusicBrainz Server/Internationalization: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
m (Reosarevok moved page Server Internationalisation to Server Internationalization over redirect: We mostly use the z version elsewhere)
m (We mostly use the z version elsewhere)
Line 1: Line 1:
The [[MusicBrainz Server]] code is using gettext to provide with automatic internationalisation of messages and texts used in the Perl code and templates.
The [[MusicBrainz Server]] code is using gettext to provide with automatic internationalization of messages and texts used in the Perl code and templates.


A .pot file is provided with all the strings used in the server. They are in English.
A .pot file is provided with all the strings used in the server. They are in English.
Line 23: Line 23:
This wiki is the perfect place to discuss specific languages translations issues such as glossary, or right-to-left required patches etc.
This wiki is the perfect place to discuss specific languages translations issues such as glossary, or right-to-left required patches etc.


* [[Server Internationalisation/French|French]]
* [[Server Internationalization/French|French]]


* [[Server Internationalisation/Italian|Italian]]
* [[Server Internationalization/Italian|Italian]]


* [[Server Internationalisation/Polish|Polish]]
* [[Server Internationalization/Polish|Polish]]


* [[Server Internationalisation/Spanish|Spanish]]
* [[Server Internationalization/Spanish|Spanish]]


* [[Server Internationalisation/Esperanto|Esperanto]]
* [[Server Internationalization/Esperanto|Esperanto]]


* [[Server Internationalisation/Finnish|Finnish]]
* [[Server Internationalization/Finnish|Finnish]]


== Variables ==
== Variables ==

Revision as of 09:02, 26 May 2023

The MusicBrainz Server code is using gettext to provide with automatic internationalization of messages and texts used in the Perl code and templates.

A .pot file is provided with all the strings used in the server. They are in English.

Getting started

If you want to help translate, go to the Transifex page and create an account. If there is already a team for your language, you can join it, if not, you can ask for the creation of a new team.

There used to be an i18n mailing list, but it is discontinued and has been replaced by new forums (using categories and tags).

Questions or problems

If you have any questions or you're having any problems, you're welcome to ask in the #metabrainz IRC channel.

If you find a bug in the server, you can enter an issue in our bug tracker.

Viewing the translations

Some of the more complete translations (generally those over 50% translated) are available on the beta server at https://beta.musicbrainz.org/. The translations do not update automatically (see development beta cycle), but the beta server uses the same database as the main server. If you want to use the beta server all of the time for your editing, click the "Use beta site" link in the footer of https://musicbrainz.org/.

Language-specific pages

This wiki is the perfect place to discuss specific languages translations issues such as glossary, or right-to-left required patches etc.

Variables

Translatable messages not only contain plain text or HTML markup, they can also contain replaceable variables. For example:

  • In {entity1} has a BookBrainz page at {entity0}, which is a URL-Work relationship link phrase, there are two entity variables whose name should not be translated, since variable {entity1} will be replaced by a work title and {entity0} by a URL.
  • In link phrases, variables are often used for (optional) attributes, in order to avoid inflating the number of messages. Below are examples with the “additional” attribute:
    • {additional} will be replaced by additional if the “additional” attribute is set, otherwise it will be removed from the text.
    • {additional:additionally} will be replaced by additionally if the “additional” attribute is set, otherwise it will be removed from the text.
    • {additional:an|a} will be replaced by an if the “additional” attribute is set, otherwise it will be replaced by a.
    • {additional:%|regular} will be replaced by additional if the “additional” attribute is set, otherwise it will be replaced by regular.
    • Hence, {additional} can be translated as {additional:aldona} in Esperanto.
  • Note that {instrument} and {vocals} variables are replaced by the specific instrument/vocals name:
    • {instrument:%|instruments} will be replaced by piano (or its translation) if the related instrument is “piano”, otherwise it will be replaced by instruments.

Importing ISO lists

There are conveniently LGPL 2.1 pretranslated lists for a bunch of ISO standard lists at http://anonscm.debian.org/gitweb/?p=iso-codes/iso-codes.git;a=tree (specifically, we use 3166, 639, and 15924).

To bring these translations in as a base for countries, languages, and scripts, follow this procedure:

  • Download a .po for translation from Transifex. We'll assume it's called mbs.po for the sake of commands below.
  • Download the proper language .po from the link above for each of the three lists. We'll assume they're called 3166.po, 639.po, and 15924.po.
  • Check the translations – many are wrong in some translations, and if so you should not import.
  • msgmerge -N 3166.po mbs.po -o mbs1.po
  • msgmerge -N 639.po mbs1.po -o mbs2.po
  • msgmerge -N 15924.po mbs2.po -o mbs-final.po
  • msgfmt -c mbs-final.po
  • Correct any errors msgfmt complains about, then use Transifex's 'Upload File' and upload mbs-final.po.

Alternatively the ISO standard lists can be uploaded directly to Transifex, which will subsequently merge the common strings itself as appropriate.

Congratulations, you should then have all the countries/languages/scripts translated!