From 914fdea53ca47877cc9eefaa0cf64d148ed4f83e Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Thu, 3 Dec 2020 11:07:03 +0100 Subject: [PATCH] add make translations to CI, fix test errors --- .gitlab-ci.yml | 1 + Makefile | 3 + l10n/.gitkeep | 0 l10n/de.json | 2 +- lib/Controller/SettingsController.php | 12 ++-- translationfiles/templates/radio.pot | 97 ++++++++++++++++----------- 6 files changed, 69 insertions(+), 46 deletions(-) create mode 100644 l10n/.gitkeep diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a3ba95..d511337 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,7 @@ compiling: script: - npm install - make build-js + - make translations artifacts: paths: - ./l10n/* diff --git a/Makefile b/Makefile index 064e575..2cbc217 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,9 @@ release: krankerl package translations: + if [ ! -d "utils/docker-ci" ]; then \ + git clone https://github.com/nextcloud/docker-ci.git utils/docker-ci; \ + fi php utils/docker-ci/translations/translationtool/translationtool.phar create-pot-files php utils/docker-ci/translations/translationtool/translationtool.phar convert-po-files diff --git a/l10n/.gitkeep b/l10n/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/l10n/de.json b/l10n/de.json index 85725e3..ab8a13d 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -42,4 +42,4 @@ "Remove from favorites" : "Von den Favoriten entfernen", "Details" : "Weitere Informationen" },"pluralForm" :"nplurals=2; plural=(n != 1);" -} +} \ No newline at end of file diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 5ccefe4..14d5b26 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -30,10 +30,12 @@ use OCP\AppFramework\Http\JSONResponse; use OCP\IConfig; use OCP\IL10N; use OCP\IRequest; -use OCP\Util; +use OCP\ILogger; class SettingsController extends ApiController { + /** @var ILogger */ + private $logger; /** @var IConfig */ private $config; @@ -48,13 +50,15 @@ class SettingsController extends ApiController { * @param string $appName * @param IRequest $request * @param string $userId + * @param ILogger $logger * @param IConfig $config * @param IL10N $l */ public function __construct( - $appName, $request, $userId, IConfig $config, IL10N $l + $appName, $request, $userId, ILogger $logger, IConfig $config, IL10N $l ) { parent::__construct($appName, $request); + $this->logger = $logger; $this->config = $config; $this->userId = $userId; $this->l = $l; @@ -69,7 +73,7 @@ class SettingsController extends ApiController { $default ); } catch (Exception $e) { - Util::writeLog('radio', $e->getMessage(), Util::ERROR); + $this->logger->error($e->getMessage()); return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); } @@ -100,7 +104,7 @@ class SettingsController extends ApiController { * @NoAdminRequired */ public function setMenuState($menuState = ""): JSONResponse { - if ($menuState == 'SEARCH') { + if ($menuState = 'SEARCH') { return new JSONResponse(['status' => 'success'], Http::STATUS_OK); }; $legalArguments = ['TOP', 'RECENT', 'NEW', 'FAVORITES', 'CATEGORIES']; diff --git a/translationfiles/templates/radio.pot b/translationfiles/templates/radio.pot index cb62455..ba2a01a 100644 --- a/translationfiles/templates/radio.pot +++ b/translationfiles/templates/radio.pot @@ -8,13 +8,13 @@ msgid "" msgstr "" "Project-Id-Version: Nextcloud 3.14159\n" "Report-Msgid-Bugs-To: translations\\@example.com\n" -"POT-Creation-Date: 2020-11-28 10:13+0100\n" +"POT-Creation-Date: 2020-12-03 10:58+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: /home/onny/projects/nextcloud-app-radio/lib/Dashboard/RadioWidget.php:60 @@ -26,161 +26,176 @@ msgid "Radio" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialAppInfoFakeDummyForL10nScript.php:3 -msgid "Radio listening app" +msgid "Listen to your favorite radio stations" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialAppInfoFakeDummyForL10nScript.php:4 -msgid "Listening to your favorite radio stations in Nextcloud" +msgid "" +"Listening to your favorite radio stations in Nextcloud! This\n" +"app uses radio-browser.info database as a backend.\n" +"\n" +"\n" +"- 🔊 Listen to radio stations directly in Nextcloud\n" +"- 🔍 Browse thousands of stations worldwide\n" +"- ⭐ Create your own list of favorite stations\n" +"- ⭕ Dashboard widget support\n" +"- ⚡ Keep track of recent played stations\n" +"- 📁 Browse stations by language, country, etc.\n" +"- 👂 Smoth audio playback and transitions" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:1 -msgid "Error fetching favorite stations" +msgid "stations" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:2 -msgid "No favorites added yet!" +msgid "Error fetching favorite stations" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:3 -msgid "Failed to fetch favorite radio stations" +msgid "No favorites added yet!" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:4 -msgid "No favorites yet" +msgid "Failed to fetch favorite radio stations" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:5 -msgid "No recent stations yet" +msgid "No favorites yet" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:6 -msgid "No search results" +msgid "No recent stations yet" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:7 -msgid "Stations you mark as favorite will show up here" +msgid "No search results" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:8 -msgid "Stations you recently played will show up here" +msgid "Stations you mark as favorite will show up here" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:9 -msgid "No stations were found matching your search term" +msgid "Stations you recently played will show up here" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:10 -msgid "No stations here" +msgid "No stations were found matching your search term" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:11 -msgid "Could not remove station from favorites" +msgid "No stations here" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:12 -msgid "Could not favor station" +msgid "Could not remove station from favorites" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:13 -msgid "Lost connection to radio station, retrying ..." +msgid "Could not favor station" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:14 -msgid "Unable to count play on remote API" +msgid "Lost connection to radio station, retrying ..." msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:15 -msgid "Could not add station to recent list" +msgid "Unable to count play on remote API" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:16 -msgid "Countries" +msgid "Could not add station to recent list" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:17 -msgid "States" +msgid "Countries" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:18 -msgid "Languages" +msgid "States" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:19 -msgid "Tags" +msgid "Languages" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:20 -msgid "Could not fetch stations from remote API" +msgid "Tags" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:21 -msgid "Unable to load favorites" +msgid "Could not fetch stations from remote API" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:22 -msgid "Top" +msgid "Unable to load favorites" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:23 -msgid "Recent" +msgid "Top" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:24 -msgid "New" +msgid "Recent" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:25 -msgid "Favorites" +msgid "New" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:26 -msgid "Categories" +msgid "Favorites" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:27 -msgid "Search" +msgid "Categories" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:28 -msgid "Stream URL" +msgid "Search" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:29 -msgid "Copy link to clipboard" +msgid "Stream URL" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:30 -msgid "Homepage" +msgid "Copy link to clipboard" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:31 -msgid "Country & Language" +msgid "Homepage" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:32 -msgid "Codec & Bitrate" +msgid "Country & Language" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:33 -msgid "Link copied to clipboard" +msgid "Codec & Bitrate" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:34 -msgid "Error while copying link to clipboard" +msgid "Link copied to clipboard" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:35 -msgid "Name" +msgid "Error while copying link to clipboard" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:36 -msgid "Add to favorites" +msgid "Name" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:37 -msgid "Remove from favorites" +msgid "Add to favorites" msgstr "" #: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:38 +msgid "Remove from favorites" +msgstr "" + +#: /home/onny/projects/nextcloud-app-radio/specialVueFakeDummyForL10nScript.js:39 msgid "Details" msgstr ""