Prevodi
Možeš doprinijeti prijevodu ovog dodatka. Za prevođenje koristimo platformu Weblate na stranici Framasoft Weblate.
Nikada nemoj izravno mijenjati datoteke u mapi languages, to bi moglo
dovesti do konflikata.
Kako uraditi određene radnje
- Stvori račun: https://weblate.framasoft.org/accounts/register/
- Potvrdi svoju e-mail adresu i slijedi poslanu poveznicu
- Stvori lozinku i postavi svoj račun
- Idi na stranicu projekta s dodacima: https://weblate.framasoft.org/projects/peertube-livechat/peertube-plugin-livechat/
- Odaberi jezik koji želiš prevesti
- Jednostavno prevedi rečenice koje nedostaju ili ispravi one koje ti se čine netočnima.
Moguće je da postoje neki „vrlo tehnički“ izrazi. Ako ne znaš 100 % što znače ili kako su prevedeni u tvom prijevodu, bolje je da ih ne prevodiš, kako bi se prikazali na engleskom.
ConverseJS prijevodi
This plugin relies on ConverseJS for the chat front-end. ConverseJS has its own translations, on its own weblate instance. You can also translate directly in the code repository. For more information, check ConverseJS translations documentation.
Dodavanje novog jezika
Ako misliš da nedostaje jezik, najprije provjeri je li ga Peertube podržava. Ako nedostaje, možeš otvoriti problem i zatražiti jezik.
Dodavanje novih izraza / koristi prijevode u kodu
Ako radiš na novim funkcijama i trebaš nove izraze, možeš ih stvoriti izravno u Weblateu. Engleska verzija je obavezna. Počni s njom.
Svaki izraz je povezan s ključem (na primjer use_chat). Odaberi
eksplicitni ključ na engleskom i upiši ga malim slovima.
If you have to test new strings without waiting for a Weblate merge, you can
modify languages/*.yml files, but avoid to commit these changes (to
minimize conflict risks).
Use translations in front-end code
Before using a string in front-end, you need to declare a new constant in
client/@types/global.d.ts. The constant name must:
- start with the prefix “LOC_”
- use the string key, upper cased
- you just have to declare its type, not its value
For example, to use “use_chat”, you have to declare:
declare const LOC_USE_CHAT: stringThe build-client.js script will read the client/@types/global.d.ts,
search for such constants, and load their values from the languages files.
Now, you can simply call peertubeHelpers.translate(LOC_USE_CHAT) in your
code.
Use translations in back-end code
In theory, the only parts of the backend code where you need localization is the settings declaration and standardized data (ActivityPub, RSS, …). Here we need to get english strings from the translation key.
Note: you should never need another language translation from backend code. Localization must be done on front-end.
There is a lib/loc.ts module providing a loc() function. Just pass it
the key to have the english string: loc('diagnostic')'.
Prijevod dokumentacije
Dokumentacija se prevodi u odgovarajućoj Weblate komponenti.
There is a specific “Hugo shortcodes” you can use to display an application string. Saying you want to display the name of the button “open_chat_new_window”, you can use this in the documentation markdown file:
{{% livechat_label open_chat_new_window %}}You can also prevent a whole page from being translating by adding
livechatnotranslation: true in the Yaml Font Matter section:
---
title: "Third party"
description: "Displaying the livechat with 3rd party software."
weight: 20
chapter: false
livechatnotranslation: true
---Never translate a string in the livechat.en.pot file, it would be
ignored. Instead, edit directly the markdown files.
If a string contains a link, you can change it for the correct link in the translated language. For example, for a link to this documentation, you can add the language code in the url.
Some strings are block of code. Don’t translate code. But you can translate comments, or parameters if relevant.
If you are not sure, just don’t translate, and ask what to do.
The tool I use to handle translations for the documentation can have strange behaviours. When I add sentences that looks like other existing sentences, it sometimes copies existing translations. So, when you have translations marked as “to check”, please make sure it doesn’t copy a string that has nothing to do with the english one before validating.
If you are now sure about the context of a string, you can check the string
location in the weblate’s right pane, and open the corresponding
documentation page. For example, for a string located in the file
support/documentation/content/en/documentation/user/streamers.md, the
corresponding url is
https://livingston.frama.io/peertube-plugin-livechat/documentation/user/streamers/.
Opće preporuke
Please be inclusive in your wordings, and please respect the code of coduct.