From 112be80ebdf96ef6a27420c1c6a10097388731a9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 26 Jul 2019 15:29:28 +0200 Subject: Improve translation plugin guide --- support/doc/plugins/guide.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.md index 1aae65a1c..b4f3e6638 100644 --- a/support/doc/plugins/guide.md +++ b/support/doc/plugins/guide.md @@ -30,6 +30,7 @@ - [Tips](#tips) - [Compatibility with PeerTube](#compatibility-with-peertube) - [Spam/moderation plugin](#spammoderation-plugin) + - [Other plugin examples](#other-plugin-examples) @@ -323,6 +324,15 @@ If you want to translate strings of your plugin (like labels of your registered The key should be one of the locales defined in [i18n.ts](https://github.com/Chocobozzz/PeerTube/blob/develop/shared/models/i18n/i18n.ts). You **must** use the complete locales (`fr-FR` instead of `fr`). +Translation files are just objects, with the english sentence as the key and the translation as the value. +`fr.json` could contain for example: + +```json +{ + "Hello world": "Hello le monde" +} +``` + ### Test your plugin/theme You'll need to have a local PeerTube instance: @@ -410,3 +420,6 @@ If you want to create an antispam/moderation plugin, you could use the following * `filter:api.video-thread-comments.list.result`: to change/hide the text of replies * `filter:video.auto-blacklist.result`: to automatically blacklist local or remote videos +### Other plugin examples + +You can take a look to "official" PeerTube plugins if you want to take inspiration from them: https://framagit.org/framasoft/peertube/official-plugins -- cgit v1.2.3