Skip to content

Languages

project-owner edited this page Dec 18, 2021 · 10 revisions

To simplify the process of adding new languages all language specific files were grouped together and placed in one folder. Here are the default languages supplied with Peppy Player:

  1. English/USA
  2. German
  3. French
  4. Russian
  5. Italian
  6. Spanish
  7. Dutch
  8. Czech
  9. Polish

The following image shows the languages folder structure:

f-0

The file languages.txt serves as the registry for all languages. Each language specific folder has the following files and sub-folders:

f-6

The process of adding new language involves the following steps:

  1. Add entry to the languages.txt file.
  2. Create folder for language specific files.
  3. Add flag.png image which will serve as the label for the language.
  4. Prepare file labels.properties. This file consists of all UI labels.
  5. Prepare file voice-commands.properties which keeps all voice commands for voice assistant.
  6. Provide TTF font file for your language if the default font FiraSans.ttf doesn't support your language.
  7. Create web radio playlists.

Let's consider the process of adding new language using Japanese as the example.

Add entry to the languages.txt file

If some of the default languages are not used they can be disabled. After that the language will be removed from the Language menu. Here is example of disabling Russian in file languages.txt:

#[Russian]
#English-USA = Английский-США
#German = Немецкий
#French = Французский
#Russian = Русский

The entry for Japanese language should look like this:

[Japanese]
English-USA = 英語
German = ドイツ人
French = フランス語
Russian = ロシア
Japanese = 日本語

Also Japanese should be added to all other sections in file language.txt. For example:

[English-USA]
English-USA = English-USA
German = German
French = French
Russian = Russian
Japanese = Japanese

After disabling Russian and enabling Japanese (and completing all next steps) the Language menu will look like this:

j-1

Create folder for language specific files

This folder should have the same name as it was defined in file languages.txt. The following image shows new folder for Japanese:

f-4

Add flag.png image

This image will represent the language in the languages menu. You can create your own image or borrow it from the Internet. The image's file format should be PNG. The size can be arbitrary as it will be resized to fit to the languages menu.

Prepare file labels.properties

The best way to prepare this file is to copy the existing file for one of the default languages and translate it to your language. Here is the example showing several labels translated to Japanese:

home = ホームメニュー

radio = 無線
screensaver = スクリーンセーバー
language = 言語
about = 約
audio-files = オーディオファイル
stream = ストリーム
audiobooks = オーディオブック
cd-player = CDプレーヤー
...

After translating labels in file labels.properties (and completing the rest steps) UI labels will look like in the following images:

j-2

j-3

Prepare file voice-commands.properties

This file contains voice commands. If you are not planning to use voice assistant there is no need to translate commands in this file. Just copy one of the existing files and keep it as is.

Provide TTF font file for your language

The default font FiraSans.ttf has Latin and Cyrillic alphabets. Therefore it can support all four default languages. It doesn't support Japanese characters. There are many web sites in the Internet which provide free fonts for any language. I found free font osaka.unicode.ttf which supports Japanese characters. It should be placed in the language folder. Only fonts in TTF format are supported.

Create web radio playlists

Web Radio playlists should be placed in folder radio-stations. The next sub-folder defines the top level menu for radio stations. The default name of that folder is Genre and it defines radio genres/folders. The following image shows the folder structure:

f-1

Each folder should have two images: folder.png and folder-on.png. Here is example of those images for the genre 'Children':

f-2

And next image shows how these images will look like in UI on Radio player screen and Genre screen:

f-3

File stations.m3u keeps the links to the radio stations for the genre defined by the folder. Here is example of two entries from that file for genre Children and language English-USA:

#Kids Public Radio. Lullaby
http://kidspublicradio2.got.net:8000/lullaby
#Kids Public Radio. Pipsqueaks
http://kidspublicradio2.got.net:8000/pipsqueaks

The first line in the station definition will serve as the station name in UI. Also the same string serves as the image name for the station logo. So for the two stations defined in the example above there are two image files:

Kids Public Radio. Lullaby.png
Kids Public Radio. Pipsqueaks.png

The order of stations in the file defines the order of stations in the menu.

The Note about Audiobooks.

Peppy player is using web site librivox.org for listening audiobooks. The audiobooks for the following languages are currently available on that web site:

  • Bulgarian
  • Chinese
  • Danish
  • Dutch
  • English
  • Esperanto
  • Finnish
  • French
  • German
  • Greek
  • Hebrew
  • Hungarian
  • Italian
  • Japanese
  • Javanese
  • Latin
  • Latvian
  • Polish
  • Portuguese
  • Russian
  • Spanish
  • Swedish
  • Tagalog
  • Tamil
  • Urdu

If the language which you are adding is not in this list then Audiobooks menu option will be disabled in Home menu and this functionality will not be available. Japanese is in the list and Audiobooks player for Japanese looks like this:

j-4

<<Previous | Next>>

Clone this wiki locally