Difference between revisions of "HOWTO-Translate ScummVM Web Site"

From ScummVM :: Wiki
Jump to navigation Jump to search
(Initial instructions to translate the web site)
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{| border="0" cellpadding="1" cellspacing="2" style="margin-left:5em; background:#FF9999; width:80%"
|- align="center"
| '''Please read carefully'''
|- style="margin-left:1em; background:#ffffff;"
|- style="background:#ffffff"
|There have been major changes with website translations. Please read this page before modifying any files. In general Weblate is now used to translate News and site Content (FAQ TBD). '''DO NOT MODIFY FILES IN I18N directories directly'''
|}
This page contains instructions to translate the ScummVM web site.
This page contains instructions to translate the ScummVM web site.


=== Getting the files to edit ===
=== Getting the files to edit ===
The sources for our web site are available on [[https://github.com/scummvm/scummvm-web github.com]]. If you are familiar with GitHub you can clone this scummvm-web repository, make modifications and open a pull request. Otherwise you might prefer using the ''Download ZIP'' button on the GitHub page from the link above make modifications and use [[http://sourceforge.net/p/scummvm/patches/ patch tracker]].
The sources for our web site are available on [[https://github.com/scummvm/scummvm-web github.com]]. If you are familiar with GitHub you can clone this scummvm-web repository, make modifications and open a pull request.


=== Adding a new language to the language menu ===
=== Adding a new language to the language menu ===
Edit the ''lang_menu.tpl'' file in the ''template'' directory to add an item for your language. You can copy one of the existing item and replace
Edit the ''index.php'' file in the ''root'' directory to add an item for your language in the $available_languages array. You can copy one of the existing items as an example.
* the language code in ''lang=en''
* The syntax is the two character language code followed by the language name. For example, to add Hebrew you would write: <syntaxhighlight lang="php">'he' => 'Hebrew',</syntaxhighlight>
* the language code in uppercase used for the badge on the web site (e.g. 'EN'')
* The language name. Write it as it is written in your language.


Please keep the languages sorted alphabetically (except for English that comes first).
Please keep the languages sorted alphabetically (except for English that comes first).


=== Translating lang.ini ===
=== Translating content and menu items ===
This is the file that contains most of the web site strings. If it does not yet exist, you need to create such a file for your language by copying the ''lang.ini'' file and add the language code to the name before the extension (for example if we were to translate to english we would name the file ''lang.en.ini''). You then simply have to translate the strings in that file. Make sure your text editor is configured to use UTF-8 encoding.
Translating site content is now handled via Weblate. You can access it here: [https://translations.scummvm.org/projects/scummvm-website/content/ Translate ScummVM website content]
This is the component that contains most of the web site strings. If it does not yet exist, you need to add a translation in Weblate.


At the start of the file you will see two special strings (''locale ='' and ''date format ='') that are used to automatically translate date.
There are two special strings that need to be set correctly. (''locale ='' and ''date format ='') that are used to automatically translate date.
* The first one is the [[https://en.wikipedia.org/wiki/Locale#POSIX_platforms language locale]], for example ''fr_FR.UTF-8'' for french from France using UTF-8 encoding.
* The first one is the [[https://en.wikipedia.org/wiki/Locale#POSIX_platforms language locale]], for example ''fr_FR.UTF-8'' for french from France using UTF-8 encoding.
* The second is the date format as described [[http://php.net/manual/en/function.strftime.php here]]. For example "%b %e, %Y" means abbreviated month name followed by the day of the month then a coma and the year coded with 4 digits. This is the format used for news in english and for example gives ''Dec 25, 2015'' in english).
* The second is the date format as described [[http://php.net/manual/en/function.strftime.php here]]. For example "%b %e, %Y" means abbreviated month name followed by the day of the month then a coma and the year coded with 4 digits. This is the format used for news in English and for example gives ''Dec 25, 2015'' in English).


=== Translating the side bar ===
=== Translating news ===
In the ''data'' directory copy the file ''menus.xml'' and add the language code in the name (e.g. ''menus.fr.xml'' for the french translation). This file does not need to be using UTF-8 encoding, but make sure the encoding mentioned at the start of the file matches the one your text editor uses to write the file. Only translate the content of the ''name'' tags (i.e. the text that appears between ''<name>'' and ''</name>'').
Translating news is also handled via Weblate. You can access it here: [https://translations.scummvm.org/projects/scummvm-website/news/ Translate ScummVM website news]


=== Translating news ===
To translate a news article, simply find the relevant strings in Weblate and update them.
If it does not already exist you need to create a directory named after the language code (e.g. ''fr'' for french or ''de'' for german) in the /data/news/ directory. Translated news will go into that directory (e.g. ''data/news/fr'').


To translate a news, copy the english version from ''data/news'' into the corresponding language news directory. Do not change the file name. Then you can translate the file. Do not modify the XML tags and do not change the date (it is automatically translated - see the [[Translating lang.ini]] section above).
To add a new language you'll need to start a new translation in Weblate but also create a directory in the project if it does not already exist. The directory is named after the language code (e.g. ''fr'' for French or ''de'' for German) in the /data/news/ directory. Inside the directory you'll need to place a .gitignore file set to ignore json files.


=== Translating the F.A.Q ===
=== Translating the F.A.Q ===
There is a lot of text in this one! To translate this file you will first to copy the english FAQ file named ''faq-xml.xml'' in the ''data'' directory to create a file for you language. As for the ''lang.ini'', add the language code before the extension (e.g. for french the FAQ file is named ''faq-xml.fr.xml''). Then translate the FAQ. Be careful note to translate the XML tags and the href names (they are used in links).
There is a lot of text in this one! To translate this file you will first to copy the english FAQ file named ''faq-xml.xml'' in the ''data'' directory to create a file for you language. Add the language code before the extension (e.g. for french the FAQ file is named ''faq-xml.fr.xml''). Then translate the FAQ. Be careful note to translate the XML tags and the href names (they are used in links).

Latest revision as of 11:32, 20 May 2019

Please read carefully
There have been major changes with website translations. Please read this page before modifying any files. In general Weblate is now used to translate News and site Content (FAQ TBD). DO NOT MODIFY FILES IN I18N directories directly

This page contains instructions to translate the ScummVM web site.

Getting the files to edit

The sources for our web site are available on [github.com]. If you are familiar with GitHub you can clone this scummvm-web repository, make modifications and open a pull request.

Adding a new language to the language menu

Edit the index.php file in the root directory to add an item for your language in the $available_languages array. You can copy one of the existing items as an example.

  • The syntax is the two character language code followed by the language name. For example, to add Hebrew you would write:
    'he' => 'Hebrew',
    

Please keep the languages sorted alphabetically (except for English that comes first).

Translating content and menu items

Translating site content is now handled via Weblate. You can access it here: Translate ScummVM website content This is the component that contains most of the web site strings. If it does not yet exist, you need to add a translation in Weblate.

There are two special strings that need to be set correctly. (locale = and date format =) that are used to automatically translate date.

  • The first one is the [language locale], for example fr_FR.UTF-8 for french from France using UTF-8 encoding.
  • The second is the date format as described [here]. For example "%b %e, %Y" means abbreviated month name followed by the day of the month then a coma and the year coded with 4 digits. This is the format used for news in English and for example gives Dec 25, 2015 in English).

Translating news

Translating news is also handled via Weblate. You can access it here: Translate ScummVM website news

To translate a news article, simply find the relevant strings in Weblate and update them.

To add a new language you'll need to start a new translation in Weblate but also create a directory in the project if it does not already exist. The directory is named after the language code (e.g. fr for French or de for German) in the /data/news/ directory. Inside the directory you'll need to place a .gitignore file set to ignore json files.

Translating the F.A.Q

There is a lot of text in this one! To translate this file you will first to copy the english FAQ file named faq-xml.xml in the data directory to create a file for you language. Add the language code before the extension (e.g. for french the FAQ file is named faq-xml.fr.xml). Then translate the FAQ. Be careful note to translate the XML tags and the href names (they are used in links).