Fix l10n and add language PL (#235)

* Fix l10n and add language PL

Improve the code for multilingualism and add translation in Polish.
This commit is contained in:
Valdnet 2021-03-19 14:02:06 +01:00 committed by GitHub
parent bda8d6f700
commit 2ba51ccddd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 7 deletions

View File

@ -23,14 +23,18 @@
*/
function postSuccess(selector, id) {
$(selector).after(" <span id='" + id + "' class='msg success'>Saved</span>");
$(selector).after(
" <span id='" + id + "' class='msg success'>" + t("breezedark", "Saved") + "</span>"
);
setTimeout(function () {
$("#" + id).remove();
}, 3000);
}
function postError(selector, id) {
$(selector).after(" <span id='" + id + "' class='msg error'>Error</span>");
$(selector).after(
" <span id='" + id + "' class='msg error'>" + t("breezedark", "Error") + "</span>"
);
setTimeout(function () {
$("#" + id).remove();
}, 3000);

View File

@ -29,7 +29,9 @@ window.addEventListener("DOMContentLoaded", function () {
})
.done(function () {
$("label[for='breezedark-enabled']").append(
" <span id='breezedark-enabled-msg' class='msg success'>Saved</span>"
" <span id='breezedark-enabled-msg' class='msg success'>" +
t("breezedark", "Saved") +
"</span>"
);
setTimeout(function () {
$("#breezedark-enabled-msg").remove();
@ -37,7 +39,9 @@ window.addEventListener("DOMContentLoaded", function () {
})
.fail(function () {
$("label[for='breezedark-enabled']").append(
" <span id='breezedark-enabled-msg' class='msg error'>Error</span>"
" <span id='breezedark-enabled-msg' class='msg error'>" +
t("breezedark", "Error") +
"</span>"
);
setTimeout(function () {
$("#breezedark-enabled-msg").remove();

20
l10n/pl.js Normal file
View File

@ -0,0 +1,20 @@
OC.L10N.register(
"breezedark",
{
"Breeze Dark" : "Breeze Dark",
"Breeze Dark theme for Nextcloud, based on the theme by KDE" : "Motyw Breeze Dark dla Nextcloud, oparty na motywie stworzonym przez KDE",
"A Dark theme based on Breeze Dark by the KDE project. Please refresh the page for changes to take effect." : "Ciemny motyw oparty na Breeze Dark projektu KDE. Odśwież stronę, aby zmiany zaczęły obowiązywać.",
"This setting will enable the theme by default, for any unauthenticated users and users who haven't set a preference." : "Ustawienie domyślnie włączy motyw dla wszystkich nieuwierzytelnionych użytkowników i użytkowników, którzy nie ustawili preferencji.",
"Enable Breeze Dark theme by default" : "Domyślnie włącz motyw Breeze Dark",
"This setting will allow you to choose if the login page should be themed when the theme is enabled by default." : "Ustawienie pozwoli wybrać, czy strona logowania ma być tematyczna, gdy motyw jest domyślnie włączony.",
"Theme the login page" : "Motyw strony logowania",
"Custom Styling" : "Niestandardowa stylizacja",
"A Breeze Dark theme for Nextcloud." : "Motyw Breeze Dark dla Nextcloud.",
"Breeze Dark theme" : "Motyw Breeze Dark",
"Enable Breeze Dark theme" : "Włącz motyw Breeze Dark",
"Insert custom styling here …" : "Tutaj wstaw własny styl…",
"Save" : "Zapisz",
"Saved" : "Zapisano",
"Error" : "Błąd"
},
"");

18
l10n/pl.json Normal file
View File

@ -0,0 +1,18 @@
{ "translations": {
"Breeze Dark" : "Breeze Dark",
"Breeze Dark theme for Nextcloud, based on the theme by KDE" : "Motyw Breeze Dark dla Nextcloud, oparty na motywie stworzonym przez KDE",
"A Dark theme based on Breeze Dark by the KDE project. Please refresh the page for changes to take effect." : "Ciemny motyw oparty na Breeze Dark projektu KDE. Odśwież stronę, aby zmiany zaczęły obowiązywać.",
"This setting will enable the theme by default, for any unauthenticated users and users who haven't set a preference." : "Ustawienie domyślnie włączy motyw dla wszystkich nieuwierzytelnionych użytkowników i użytkowników, którzy nie ustawili preferencji.",
"Enable Breeze Dark theme by default" : "Domyślnie włącz motyw Breeze Dark",
"This setting will allow you to choose if the login page should be themed when the theme is enabled by default." : "Ustawienie pozwoli wybrać, czy strona logowania ma być tematyczna, gdy motyw jest domyślnie włączony.",
"Theme the login page" : "Motyw strony logowania",
"Custom Styling" : "Niestandardowa stylizacja",
"A Breeze Dark theme for Nextcloud." : "Motyw Breeze Dark dla Nextcloud.",
"Breeze Dark theme" : "Motyw Breeze Dark",
"Enable Breeze Dark theme" : "Włącz motyw Breeze Dark",
"Insert custom styling here …" : "Tutaj wstaw własny styl…",
"Save" : "Zapisz",
"Saved" : "Zapisano",
"Error" : "Błąd"
},"pluralForm" :""
}

View File

@ -33,11 +33,11 @@ script('breezedark', 'settings-admin');
<p><?php p($l->t("This setting will enable the theme by default, for any unauthenticated users and users who haven't set a preference.")); ?></p>
<input type="checkbox" class="checkbox" id="breezedark-theme-enabled" <?php p($themeEnabled ? "checked" : ""); ?>>
<label for="breezedark-theme-enabled"><?php p($l->t("Enable Breeze Dark theme by default")); ?></label>
<p><?php p($l->t("This setting will allow you to choose if the login page should be themed when the theme is enabled by default")); ?></p>
<p><?php p($l->t("This setting will allow you to choose if the login page should be themed when the theme is enabled by default.")); ?></p>
<input type="checkbox" class="checkbox" id="breezedark-theme-login-page" <?php p($themeEnabled ? "" : "disabled");?> <?php p($themeLoginPage ? "checked" : "");?>>
<label for="breezedark-theme-login-page"><?php p($l->t("Theme the login page")); ?></label>
<h3><?php p($l->t("Custom Styling")); ?></h3>
<textarea id="breezedark-theme-custom-styling" style="width: 100%; height: 200px; font-family: monospace;" placeholder="Insert custom styling here..."><?php p($themeCustomStyling); ?></textarea>
<button id="breezedark-theme-custom-styling-button">Save</button>
<textarea id="breezedark-theme-custom-styling" style="width: 100%; height: 200px; font-family: monospace;" placeholder="<?php p($l->t("Insert custom styling here ")); ?>"><?php p($themeCustomStyling); ?></textarea>
<button id="breezedark-theme-custom-styling-button"><?php p($l->t("Save")); ?></button>
</div>