Quellcode durchsuchen

added translation for Czech, provided by @info-path, fixes #424

El RIDO vor 7 Jahren
Ursprung
Commit
8dc9db90c9
8 geänderte Dateien mit 185 neuen und 3 gelöschten Zeilen
  1. 1 0
      CHANGELOG.md
  2. 1 0
      CREDITS.md
  3. 165 0
      i18n/cs.json
  4. 3 1
      js/privatebin.js
  5. 2 0
      lib/I18n.php
  6. 1 1
      tpl/bootstrap.php
  7. 1 1
      tpl/page.php
  8. 11 0
      tst/I18nTest.php

+ 1 - 0
CHANGELOG.md

@@ -1,6 +1,7 @@
 # PrivateBin version history
 
   * **1.3 (not yet released)**
+    * ADDED: Translation for Czech (#424)
     * ADDED: Threat modeled the application (#177)
     * CHANGED: Minimum required PHP version is 5.5, due to a change in the identicon library
     * CHANGED: Minimum required browser versions are Firefox 54, Chrome 57, Opera 44, Safari 11, Edge 16, due to use of WebCrypto API, async/await, ES6 & WebAssembly features - all Internet Explorer versions are incompatible

+ 1 - 0
CREDITS.md

@@ -41,3 +41,4 @@ Sébastien Sauvage - original idea and main developer
 * Tulio Leao - Portuguese
 * Michael van Schaik - Dutch
 * Péter Tabajdi - Hungarian
+* info-path - Czech

+ 165 - 0
i18n/cs.json

@@ -0,0 +1,165 @@
+{
+    "PrivateBin": "PrivateBin",
+    "%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
+        "%s je minimalistický open source 'pastebin' server, který neanalyzuje vložená data. Data jsou šifrována <i>v prohlížeči</i> pomocí 256 bitů AES. Více informací na <a href=\"https://privatebin.info/\">stránce projetu</a>.",
+    "Because ignorance is bliss":
+        "Protože nevědomost je sladká",
+    "en": "cs",
+    "Paste does not exist, has expired or has been deleted.":
+        "Vložený text neexistuje, expiroval nebo byl odstraněn.",
+    "%s requires php %s or above to work. Sorry.":
+        "%s vyžaduje php %s nebo vyšší. Lituji.",
+    "%s requires configuration section [%s] to be present in configuration file.":
+        "%s requires configuration section [%s] to be present in configuration file.",
+    "Please wait %d seconds between each post.":
+        "Počet sekund do dalšího příspěvku: %d.",
+    "Paste is limited to %s of encrypted data.":
+        "Příspěvek je limitován na %s šífrovaných dat",
+    "Invalid data.":
+        "Chybná data.",
+    "You are unlucky. Try again.":
+        "Lituji, zkuste to znovu.",
+    "Error saving comment. Sorry.":
+        "Chyba při ukládání komentáře.",
+    "Error saving paste. Sorry.":
+        "Chyba při ukládání příspěvku.",
+    "Invalid paste ID.":
+        "Chybně vložené ID.",
+    "Paste is not of burn-after-reading type.":
+        "Paste is not of burn-after-reading type.",
+    "Wrong deletion token. Paste was not deleted.":
+        "Wrong deletion token. Paste was not deleted.",
+    "Paste was properly deleted.":
+        "Paste was properly deleted.",
+    "JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
+        "JavaScript is required for %s to work.<br />Sorry for the inconvenience.",
+    "%s requires a modern browser to work.":
+        "%%s requires a modern browser to work.",
+    "Still using Internet Explorer? Do yourself a favor, switch to a modern browser:":
+        "Still using Internet Explorer? Do yourself a favor, switch to a modern browser:",
+    "New":
+        "Nový",
+    "Send":
+        "Odeslat",
+    "Clone":
+        "Klonovat",
+    "Raw text":
+        "Pouze Text",
+    "Expires":
+        "Expirace",
+    "Burn after reading":
+        "Po přečtení smazat",
+    "Open discussion":
+        "Povolit komentáře",
+    "Password (recommended)":
+        "Heslo (doporučeno)",
+    "Discussion":
+        "Komentáře",
+    "Toggle navigation":
+        "Toggle navigation",
+    "%d seconds": ["%d sekuda", "%d sekundy", "%d sekund"],
+    "%d minutes": ["%d minuta", "%d minuty", "%d minut"],
+    "%d hours": ["%d hodin", "%d hodiny", "%d hodin"],
+    "%d days": ["%d den", "%d dny", "%d dní"],
+    "%d weeks": ["%d týden", "%d týdeny", "%d týdnů"],
+    "%d months": ["%d měsíc", "%d měsíce", "%d měsíců"],
+    "%d years": ["%d rok", "%d roky", "%d roků"],
+    "Never":
+        "Nikdy",
+    "Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.":
+        "Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.",
+    "This document will expire in %d seconds.":
+        ["Tento dokument expiruje za %d sekundu.", "Tento dokument expiruje za %d sekundy.", "Tento dokument expiruje za %d sekund."],
+    "This document will expire in %d minutes.":
+        ["Tento dokument expiruje za %d minutu.", "Tento dokument expiruje za %d minuty.", "Tento dokument expiruje za %d minut."],
+    "This document will expire in %d hours.":
+        ["Tento dokument expiruje za %d hodinu.", "Tento dokument expiruje za %d hodiny.", "Tento dokument expiruje za %d hodin."],
+    "This document will expire in %d days.":
+        ["Tento dokument expiruje za %d den.", "Tento dokument expiruje za %d dny.", "Tento dokument expiruje za %d dny."],
+    "This document will expire in %d months.":
+        ["Tento dokument expiruje za %d měsíc.", "Tento dokument expiruje za %d měsíce.", "Tento dokument expiruje za %d měsíců."],
+    "Please enter the password for this paste:":
+        "Zadejte prosím heslo:",
+    "Could not decrypt data (Wrong key?)":
+        "Could not decrypt data (Wrong key?)",
+    "Could not delete the paste, it was not stored in burn after reading mode.":
+        "Could not delete the paste, it was not stored in burn after reading mode.",
+    "FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.":
+        "FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.",
+    "Could not decrypt comment; Wrong key?":
+        "Could not decrypt comment; Wrong key?",
+    "Reply":
+        "Reply",
+    "Anonymous":
+        "Anonym",
+    "Avatar generated from IP address":
+        "Avatar generated from IP address",
+    "Add comment":
+        "Přidat komentář",
+    "Optional nickname…":
+        "Volitelný nickname…",
+    "Post comment":
+        "Odeslat komentář",
+    "Sending comment…":
+        "Odesílání komentáře…",
+    "Comment posted.":
+        "Komentář odeslán.",
+    "Could not refresh display: %s":
+        "Could not refresh display: %s",
+    "unknown status":
+        "neznámý stav",
+    "server error or not responding":
+        "Chyba na serveru nebo server neodpovídá",
+    "Could not post comment: %s":
+        "Nelze odeslat komentář: %s",
+    "Sending paste…":
+        "Odesílání příspěvku…",
+    "Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
+        "Váš link je <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Stiskněte [Ctrl]+[c] pro zkopírování)</span>",
+    "Delete data":
+        "Odstranit data",
+    "Could not create paste: %s":
+        "Nelze vytvořit příspěvek: %s",
+    "Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)":
+        "Nepodařilo se dešifrovat příspěvek: V adrese chybí dešifrovací klíč (Možnou příčinou může být URL shortener?)",
+    "Format": "Formát",
+    "Plain Text": "Prostý Text",
+    "Source Code": "Zdrojový kód",
+    "Markdown": "Markdown",
+    "Download attachment": "Stáhnout přílohu",
+    "Cloned: '%s'": "Klonováno: '%s'",
+    "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.",
+    "Attach a file": "Připojit soubor",
+    "alternatively drag & drop a file or paste an image from the clipboard": "alternatively drag & drop a file or paste an image from the clipboard",
+    "File too large, to display a preview. Please download the attachment.": "Soubor je příliš velký pro zobrazení náhledu. Stáhněte si přílohu.",
+    "Remove attachment": "Odstranit přílohu",
+    "Your browser does not support uploading encrypted files. Please use a newer browser.":
+        "Váš prohlížeč nepodporuje nahrávání šifrovaných souborů. Použijte modernější verzi prohlížeče.",
+    "Invalid attachment.": "Chybná příloha.",
+    "Options": "Volby",
+    "Shorten URL": "Shorten URL",
+    "Editor": "Editor",
+    "Preview": "Náhled",
+    "%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
+        "%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.",
+    "Decrypt":
+        "Decrypt",
+    "Enter password":
+        "Zadejte heslo",
+    "Loading…": "Loading…",
+    "Decrypting paste…": "Decrypting paste…",
+    "Preparing new paste…": "Preparing new paste…",
+    "In case this message never disappears please have a look at <a href=\"%s\">this FAQ for information to troubleshoot</a>.":
+        "In case this message never disappears please have a look at <a href=\"%s\">this FAQ for information to troubleshoot</a>.",
+    "+++ no paste text +++": "+++ žádný vložený text +++",
+    "Could not get paste data: %s":
+        "Could not get paste data: %s",
+    "QR code": "QR code",
+    "I love you too, bot…": "I love you too, bot…",
+    "This website is using an insecure HTTP connection! Please use it only for testing.":
+        "This website is using an insecure HTTP connection! Please use it only for testing.",
+    "For more information <a href=\"%s\">see this FAQ entry</a>.":
+        "For more information <a href=\"%s\">see this FAQ entry</a>.",
+    "Your browser may require an HTTPS connection to support the WebCrypto API. Try <a href=\"%s\">switching to HTTPS</a>.":
+        "Your browser may require an HTTPS connection to support the WebCrypto API. Try <a href=\"%s\">switching to HTTPS</a>."
+}

+ 3 - 1
js/privatebin.js

@@ -420,7 +420,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
          * @prop   {string[]}
          * @readonly
          */
-        const supportedLanguages = ['de', 'es', 'fr', 'it', 'hu', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sl', 'zh'];
+        const supportedLanguages = ['cs', 'de', 'es', 'fr', 'it', 'hu', 'no', 'nl', 'pl', 'pt', 'oc', 'ru', 'sl', 'zh'];
 
         /**
          * built in language
@@ -571,6 +571,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
         me.getPluralForm = function(n) {
             switch (language)
             {
+                case 'cs':
+                    return n === 1 ? 0 : (n >= 2 && n <=4 ? 1 : 2);
                 case 'fr':
                 case 'oc':
                 case 'zh':

+ 2 - 0
lib/I18n.php

@@ -294,6 +294,8 @@ class I18n
     protected static function _getPluralForm($n)
     {
         switch (self::$_language) {
+            case 'cs':
+                return $n == 1 ? 0 : ($n >= 2 && $n <=4 ? 1 : 2);
             case 'fr':
             case 'oc':
             case 'zh':

+ 1 - 1
tpl/bootstrap.php

@@ -72,7 +72,7 @@ if ($MARKDOWN):
 endif;
 ?>
 		<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.10.js" integrity="sha512-CqskSFXERL38A1PJP9BlO04me7kmwgDIhN1+k24RoFiisEwXA0BMdm0lzJC7g5jCRZ4k5OYdOJGEqW9CwDl4CA==" crossorigin="anonymous"></script>
-		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-V0v5OOCcrMFtPsP9xWbKjoaRBobWrMdKdiDPn1tK8Kq8uzbEOK8tY0JXCbEqVpPyJ3/hVrtfjdXhgGaxeMUj3g==" crossorigin="anonymous"></script>
+		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-qbbaN+vdcDPfAPXaU1pMI1MzHrjZNKRwgx/l7jE1Ma1ebJ8K7GhoKbOrqPi/xkYOrWPE94tBxvSxuvqe6czAqA==" crossorigin="anonymous"></script>
 		<!--[if IE]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;}</style>
 		<![endif]-->

+ 1 - 1
tpl/page.php

@@ -50,7 +50,7 @@ if ($MARKDOWN):
 endif;
 ?>
 		<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.10.js" integrity="sha512-CqskSFXERL38A1PJP9BlO04me7kmwgDIhN1+k24RoFiisEwXA0BMdm0lzJC7g5jCRZ4k5OYdOJGEqW9CwDl4CA==" crossorigin="anonymous"></script>
-		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-V0v5OOCcrMFtPsP9xWbKjoaRBobWrMdKdiDPn1tK8Kq8uzbEOK8tY0JXCbEqVpPyJ3/hVrtfjdXhgGaxeMUj3g==" crossorigin="anonymous"></script>
+		<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-qbbaN+vdcDPfAPXaU1pMI1MzHrjZNKRwgx/l7jE1Ma1ebJ8K7GhoKbOrqPi/xkYOrWPE94tBxvSxuvqe6czAqA==" crossorigin="anonymous"></script>
 		<!--[if IE]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;}</style>
 		<![endif]-->

+ 11 - 0
tst/I18nTest.php

@@ -130,6 +130,17 @@ class I18nTest extends PHPUnit_Framework_TestCase
         $this->assertEquals('104 ur',  I18n::_('%d hours', 104), '104 hours in Slowene');
     }
 
+    public function testBrowserLanguageCsDetection()
+    {
+        $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'cs;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
+        I18n::loadTranslations();
+        $this->assertEquals('cs', I18n::_('en'), 'browser language cs');
+        $this->assertEquals('1 hodin', I18n::_('%d hours', 1), '1 hour in Czech');
+        $this->assertEquals('2 hodiny', I18n::_('%d hours', 2), '2 hours in Czech');
+        $this->assertEquals('5 minut',  I18n::_('%d minutes', 5), '5 minutes in Czech');
+        $this->assertEquals('14 minut',  I18n::_('%d minutes', 14), '14 minutes in Czech');
+    }
+
     public function testBrowserLanguageAnyDetection()
     {
         $_SERVER['HTTP_ACCEPT_LANGUAGE'] = '*';