From e80c726f92c3694e7f60e58fec472e3070eddf9d Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 25 Mar 2017 12:46:08 +0100 Subject: [PATCH 1/5] added unit test for missing message IDs accross all translations, added IDs found this way to translation files (#201) --- i18n/de.json | 3 +-- i18n/es.json | 13 ++++++++----- i18n/fr.json | 13 ++++++++----- i18n/it.json | 13 ++++++++----- i18n/no.json | 13 ++++++++----- i18n/oc.json | 13 ++++++++----- i18n/pl.json | 13 ++++++++----- i18n/pt.json | 5 ++++- i18n/ru.json | 10 ++++------ i18n/sl.json | 13 ++++++++----- tst/I18nTest.php | 20 ++++++++++++++++++++ 11 files changed, 85 insertions(+), 44 deletions(-) diff --git a/i18n/de.json b/i18n/de.json index 7974d773..332c61c8 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -151,6 +151,5 @@ "Preparing new paste…": "Bereite neues Paste vor…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": "Wenn diese Nachricht nicht mehr verschwindet, schau bitte in die FAQ (englisch), um zu sehen, wie der Fehler behoben werden kann.", - "+++ no paste text +++": - "+++ kein Paste-Text +++" + "+++ no paste text +++": "+++ kein Paste-Text +++" } diff --git a/i18n/es.json b/i18n/es.json index e957c8f8..98251e98 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -92,7 +92,7 @@ "Responder", "Anonymous": "Anónimo", - "Anonymous avatar (Vizhash of the IP address)": + "Avatar generated from IP address": "Avatar anónimo (Vizhash de la dirección IP)", "Add comment": "Añadir comentario", @@ -112,8 +112,8 @@ "Error del servidor o el servidor no responde", "Could not post comment: %s": "No fue posible publicar comentario: %s", - "Sending paste (Please move your mouse for more entropy)…": - "Enviando texto (Por favor, mueva el ratón para mayor entropía)…", + "Please move your mouse for more entropy…": + "Por favor, mueva el ratón para mayor entropía…", "Sending paste…": "Enviando texto…", "Your paste is %s (Hit [Ctrl]+[c] to copy)": @@ -129,7 +129,7 @@ "Source Code": "Código fuente", "Markdown": "Markdown", "Download attachment": "Descargar adjunto", - "Cloned file attached.": "Archivo clonado adjunto.", + "Cloned: '%s'": "Clonado: '%s'.", "Attach a file": "Adjuntar archivo", "Remove attachment": "Remover adjunto", "Your browser does not support uploading encrypted files. Please use a newer browser.": @@ -146,6 +146,9 @@ "Enter password": "Ingrese contraseña", "Loading…": "Cargando…", + "Decrypting paste…": "Decrypting paste…", + "Preparing new paste…": "Preparing new paste…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": - "En caso de que este mensaje nunca desaparezca por favor revise este FAQ para obtener información para solucionar problemas." + "En caso de que este mensaje nunca desaparezca por favor revise este FAQ para obtener información para solucionar problemas.", + "+++ no paste text +++": "+++ no paste text +++" } diff --git a/i18n/fr.json b/i18n/fr.json index 35cfd659..d5d447e0 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -92,7 +92,7 @@ "Répondre", "Anonymous": "Anonyme", - "Anonymous avatar (Vizhash of the IP address)": + "Avatar generated from IP address": "Avatar anonyme (Vizhash de l'adresse IP)", "Add comment": "Ajouter un commentaire", @@ -112,8 +112,8 @@ "Le serveur ne répond pas ou a rencontré une erreur", "Could not post comment: %s": "Impossible de poster le commentaire : %s", - "Sending paste (Please move your mouse for more entropy)…": - "Envoi du paste (Merci de bouger votre souris pour plus d'entropie)…", + "Please move your mouse for more entropy…": + "Merci de bouger votre souris pour plus d'entropie…", "Sending paste…": "Envoi du paste…", "Your paste is %s (Hit [Ctrl]+[c] to copy)": @@ -138,7 +138,7 @@ "Source Code": "Code source", "Markdown": "Markdown", "Download attachment": "Télécharger la pièce jointe", - "Cloned file attached.": "Cloner le fichier attaché.", + "Cloned: '%s'": "Cloner '%s'", "Attach a file": "Attacher un fichier ", "Remove attachment": "Enlever l'attachement", "Your browser does not support uploading encrypted files. Please use a newer browser.": @@ -155,6 +155,9 @@ "Enter password": "Entrez le mot de passe", "Loading…": "Chargement…", + "Decrypting paste…": "Decrypting paste…", + "Preparing new paste…": "Preparing new paste…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": - "Si ce message ne disparaîssait pas, jetez un oeil à cette FAQ pour des idées de résolution (en Anglais)." + "Si ce message ne disparaîssait pas, jetez un oeil à cette FAQ pour des idées de résolution (en Anglais).", + "+++ no paste text +++": "+++ no paste text +++" } diff --git a/i18n/it.json b/i18n/it.json index dc56fa75..b7b19e8c 100644 --- a/i18n/it.json +++ b/i18n/it.json @@ -92,7 +92,7 @@ "Rispondi", "Anonymous": "Anonimo", - "Anonymous avatar (Vizhash of the IP address)": + "Avatar generated from IP address": "Avatar Anonimo (Vizhash dell'indirizzo IP)", "Add comment": "Aggiungi un commento", @@ -112,8 +112,8 @@ "errore o mancata risposta dal server", "Could not post comment: %s": "Impossibile inviare il commento: %s", - "Sending paste (Please move your mouse for more entropy)…": - "Invio messaggio (Muovi il mouse in modo casuale, per generare maggior entropia)…", + "Please move your mouse for more entropy…": + "Muovi il mouse in modo casuale, per generare maggior entropia…", "Sending paste…": "Messaggio in fase di invio…", "Your paste is %s (Hit [Ctrl]+[c] to copy)": @@ -129,7 +129,7 @@ "Source Code": "Codice Sorgente", "Markdown": "Markdown", "Download attachment": "Scarica Allegato", - "Cloned file attached.": "Copia del file allegata.", + "Cloned: '%s'": "Copia: '%s'", "Attach a file": "Allega un file", "Remove attachment": "Rimuovi allegato", "Your browser does not support uploading encrypted files. Please use a newer browser.": @@ -146,6 +146,9 @@ "Enter password": "Inserisci la password", "Loading…": "Loading…", + "Decrypting paste…": "Decrypting paste…", + "Preparing new paste…": "Preparing new paste…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": - "Nel caso questo messaggio non scompaia, controlla questa FAQ per trovare informazioni su come risolvere il problema (in Inglese)." + "Nel caso questo messaggio non scompaia, controlla questa FAQ per trovare informazioni su come risolvere il problema (in Inglese).", + "+++ no paste text +++": "+++ no paste text +++" } diff --git a/i18n/no.json b/i18n/no.json index fd56583d..f131e4fe 100644 --- a/i18n/no.json +++ b/i18n/no.json @@ -92,7 +92,7 @@ "Svar", "Anonymous": "Anonym", - "Anonymous avatar (Vizhash of the IP address)": + "Avatar generated from IP address": "Anonym avatar (Vizhash av IP adressen)", "Add comment": "Legg til kommentar", @@ -112,8 +112,8 @@ "server feilet eller svarer ikke", "Could not post comment: %s": "Kunne ikke sende kommentar: %s", - "Sending paste (Please move your mouse for more entropy)…": - "Sender innlegg (Flytt musen for mere entropi)…", + "Please move your mouse for more entropy…": + "Flytt musen for mere entropi…", "Sending paste…": "Sender innlegg…", "Your paste is %s (Hit [Ctrl]+[c] to copy)": @@ -129,7 +129,7 @@ "Source Code": "Kildekode", "Markdown": "Oppmerket", "Download attachment": "Last ned vedlegg", - "Cloned file attached.": "Kopier vedlegg.", + "Cloned: '%s'": "Kopier: '%s'", "Attach a file": "Legg til fil", "Remove attachment": "Slett vedlegg", "Your browser does not support uploading encrypted files. Please use a newer browser.": @@ -146,6 +146,9 @@ "Enter password": "Skriv inn passord", "Loading…": "Laster…", + "Decrypting paste…": "Decrypting paste…", + "Preparing new paste…": "Preparing new paste…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": - "Hvis denne meldingen ikke forsvinner kan du ta en titt på siden med ofte stilte spørsmål for informasjon om feilsøking." + "Hvis denne meldingen ikke forsvinner kan du ta en titt på siden med ofte stilte spørsmål for informasjon om feilsøking.", + "+++ no paste text +++": "+++ no paste text +++" } diff --git a/i18n/oc.json b/i18n/oc.json index b6b449de..8f923b1b 100644 --- a/i18n/oc.json +++ b/i18n/oc.json @@ -92,7 +92,7 @@ "Respondre", "Anonymous": "Anonime", - "Anonymous avatar (Vizhash of the IP address)": + "Avatar generated from IP address": "Avatar anonime (Vizhash de l'adreça IP)", "Add comment": "Apondre un comentari", @@ -112,8 +112,8 @@ "Lo servidor respond pas o a rencontrat una error", "Could not post comment: %s": "Impossible de mandar lo comentari : %s", - "Sending paste (Please move your mouse for more entropy)…": - "Mandadís del tèxte (Mercés de bolegar vòstra mirga per mai entropia)…", + "Please move your mouse for more entropy…": + "Mercés de bolegar vòstra mirga per mai entropia…", "Sending paste…": "Mandadís del tèxte…", "Your paste is %s (Hit [Ctrl]+[c] to copy)": @@ -138,7 +138,7 @@ "Source Code": "Còdi font", "Markdown": "Markdown", "Download attachment": "Telecargar la pèça junta", - "Cloned file attached.": "Clonar lo fichièr junt.", + "Cloned: '%s'": "Clonar: '%s'", "Attach a file": "Juntar un fichièr ", "Remove attachment": "Levar la pèca junta", "Your browser does not support uploading encrypted files. Please use a newer browser.": @@ -155,6 +155,9 @@ "Enter password": "Picatz lo senhal", "Loading…": "Cargament…", + "Decrypting paste…": "Decrypting paste…", + "Preparing new paste…": "Preparing new paste…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": - "Se per cas aqueste messatge quita pas de s'afichar mercés de gaitar aquesta FAQ per las solucions (en Anglés)." + "Se per cas aqueste messatge quita pas de s'afichar mercés de gaitar aquesta FAQ per las solucions (en Anglés).", + "+++ no paste text +++": "+++ no paste text +++" } diff --git a/i18n/pl.json b/i18n/pl.json index 99554981..b722c480 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -92,7 +92,7 @@ "Odpowiedz", "Anonymous": "Anonim", - "Anonymous avatar (Vizhash of the IP address)": + "Avatar generated from IP address": "Anonimowy avatar (Vizhash z adresu IP)", "Add comment": "Dodaj komentarz", @@ -112,8 +112,8 @@ "bląd serwera lub brak odpowiedzi", "Could not post comment: %s": "Nie udało się wysłać komentarza: %s", - "Sending paste (Please move your mouse for more entropy)…": - "Wysyłanie wklejki (proszę poruszać myszą aby uzyskać większą entropię)…", + "Please move your mouse for more entropy…": + "Proszę poruszać myszą aby uzyskać większą entropię…", "Sending paste…": "Wysyłanie wklejki…", "Your paste is %s (Hit [Ctrl]+[c] to copy)": @@ -129,7 +129,7 @@ "Source Code": "Kod źródłowy", "Markdown": "Markdown", "Download attachment": "Pobierz załącznik", - "Cloned file attached.": "Sklonowano załączony plik.", + "Cloned: '%s'": "Sklonowano: '%s'", "Attach a file": "Załącz plik", "Remove attachment": "Usuń załącznik", "Your browser does not support uploading encrypted files. Please use a newer browser.": @@ -146,6 +146,9 @@ "Enter password": "Wpisz hasło", "Loading…": "Loading…", + "Decrypting paste…": "Decrypting paste…", + "Preparing new paste…": "Preparing new paste…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": - "In case this message never disappears please have a look at this FAQ for information to troubleshoot (in English)." + "In case this message never disappears please have a look at this FAQ for information to troubleshoot (in English).", + "+++ no paste text +++": "+++ no paste text +++" } diff --git a/i18n/pt.json b/i18n/pt.json index 06f72c51..01d5dfe8 100644 --- a/i18n/pt.json +++ b/i18n/pt.json @@ -146,6 +146,9 @@ "Enter password": "Digite a senha", "Loading…": "Carregando…", + "Decrypting paste…": "Decrypting paste…", + "Preparing new paste…": "Preparing new paste…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": - "Caso essa mensagem nunca desapareça, por favor veja este FAQ para saber como resolver os problemas." + "Caso essa mensagem nunca desapareça, por favor veja este FAQ para saber como resolver os problemas.", + "+++ no paste text +++": "+++ no paste text +++" } diff --git a/i18n/ru.json b/i18n/ru.json index ca4c707b..53431ad2 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -92,7 +92,7 @@ "Ответить", "Anonymous": "Аноним", - "Anonymous avatar (Vizhash of the IP address)": + "Avatar generated from IP address": "Анонимный аватар (Vizhash IP адреса)", "Add comment": "Добавить комментарий", @@ -104,6 +104,8 @@ "Отправка комментария…", "Comment posted.": "Комментарий опубликован.", + "Could not refresh display: %s": + "Could not refresh display: %s", "unknown status": "неизвестная причина", "server error or not responding": @@ -138,7 +140,6 @@ "Source Code": "Исходный код", "Markdown": "Язык разметки", "Download attachment": "Скачать прикрепленный файл", - "Cloned file attached.": "Дубликат файла прикреплен.", "Cloned: '%s'": "Дублировано: '%s'", "The cloned file '%s' was attached to this paste.": "Дубликат файла '%s' был прикреплен к этой записи.", @@ -157,13 +158,10 @@ "Расшифровать", "Enter password": "Введите пароль", - "Uploading paste… Please wait.": - "Отправка записи… Пожалуйста подождите.", "Loading…": "Загрузка…", "Decrypting paste…": "Расшифровка записи…", "Preparing new paste…": "Подготовка новой записи…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": "Если данное сообщение не исчезает длительное время, посмотрите этот FAQ с информацией о возможном решении проблемы (на английском).", - "+++ no paste text +++": - "+++ в записи нет текста +++" + "+++ no paste text +++": "+++ в записи нет текста +++" } diff --git a/i18n/sl.json b/i18n/sl.json index 00b09702..4c0a7e9f 100644 --- a/i18n/sl.json +++ b/i18n/sl.json @@ -92,7 +92,7 @@ "Odgovori", "Anonymous": "Aninomno", - "Anonymous avatar (Vizhash of the IP address)": + "Avatar generated from IP address": "Anonimen avatar (Vizhash IP naslova)", "Add comment": "Dodaj komentar", @@ -112,8 +112,8 @@ "napaka na strežniku, ali pa se strežnik ne odziva", "Could not post comment: %s": "Komentarja ni bilo mogoče objaviti : %s", - "Sending paste (Please move your mouse for more entropy)…": - "Pošiljam prilepek (prosim premakni svojo miško za več entropije) …", + "Please move your mouse for more entropy…": + "Prosim premakni svojo miško za več entropije…", "Sending paste…": "Pošiljam prilepek…", "Your paste is %s (Hit [Ctrl]+[c] to copy)": @@ -138,7 +138,7 @@ "Source Code": "Odprta koda", "Markdown": "Markdown", "Download attachment": "Pretoči priponko", - "Cloned file attached.": "Pripeta datoteka klonirana", + "Cloned: '%s'": "'%s' klonirana", "Attach a file": "Pripni datoteko", "Remove attachment": "Odstrani priponko", "Your browser does not support uploading encrypted files. Please use a newer browser.": @@ -155,6 +155,9 @@ "Enter password": "Prosim vnesi geslo", "Loading…": "Loading…", + "Decrypting paste…": "Decrypting paste…", + "Preparing new paste…": "Preparing new paste…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": - "In case this message never disappears please have a look at this FAQ for information to troubleshoot (in English)." + "In case this message never disappears please have a look at this FAQ for information to troubleshoot (in English).", + "+++ no paste text +++": "+++ no paste text +++" } diff --git a/tst/I18nTest.php b/tst/I18nTest.php index 91c92aa6..187fd1a2 100644 --- a/tst/I18nTest.php +++ b/tst/I18nTest.php @@ -142,4 +142,24 @@ class I18nTest extends PHPUnit_Framework_TestCase I18n::loadTranslations(); $this->assertEquals('some string + 1', I18n::_('some %s + %d', 'string', 1), 'browser language en'); } + + public function testMessageIdsExistInAllLanguages() + { + $messageIds = array(); + $languages = array(); + $dir = dir(PATH . 'i18n'); + while (false !== ($file = $dir->read())) { + if (strlen($file) === 7) { + $language = substr($file, 0, 2); + $translations = json_decode(file_get_contents(PATH . 'i18n' . DIRECTORY_SEPARATOR . $file), true); + $messageIds = array_unique($messageIds + array_keys($translations)); + $languages[$language] = $translations; + } + } + foreach ($messageIds as $messageId) { + foreach (array_keys($languages) as $language) { + $this->assertArrayHasKey($messageId, $languages[$language], "message ID '$messageId' exists in translation file $language.json"); + } + } + } } From 44327bed58b409500fdb62b37efabadc1309a4ba Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 25 Mar 2017 13:19:11 +0100 Subject: [PATCH 2/5] added missing/removed translation IDs found using improved unit test (#201) --- i18n/es.json | 1 + i18n/fr.json | 1 + i18n/it.json | 1 + i18n/no.json | 1 + i18n/oc.json | 1 + i18n/pl.json | 1 + i18n/pt.json | 1 + i18n/ru.json | 2 -- i18n/sl.json | 1 + tst/I18nTest.php | 26 +++++++++++++++++++------- 10 files changed, 27 insertions(+), 9 deletions(-) diff --git a/i18n/es.json b/i18n/es.json index 98251e98..427f90dc 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -130,6 +130,7 @@ "Markdown": "Markdown", "Download attachment": "Descargar adjunto", "Cloned: '%s'": "Clonado: '%s'.", + "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.", "Attach a file": "Adjuntar archivo", "Remove attachment": "Remover adjunto", "Your browser does not support uploading encrypted files. Please use a newer browser.": diff --git a/i18n/fr.json b/i18n/fr.json index d5d447e0..10c36a4e 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -139,6 +139,7 @@ "Markdown": "Markdown", "Download attachment": "Télécharger la pièce jointe", "Cloned: '%s'": "Cloner '%s'", + "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.", "Attach a file": "Attacher un fichier ", "Remove attachment": "Enlever l'attachement", "Your browser does not support uploading encrypted files. Please use a newer browser.": diff --git a/i18n/it.json b/i18n/it.json index b7b19e8c..583e0e49 100644 --- a/i18n/it.json +++ b/i18n/it.json @@ -130,6 +130,7 @@ "Markdown": "Markdown", "Download attachment": "Scarica Allegato", "Cloned: '%s'": "Copia: '%s'", + "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.", "Attach a file": "Allega un file", "Remove attachment": "Rimuovi allegato", "Your browser does not support uploading encrypted files. Please use a newer browser.": diff --git a/i18n/no.json b/i18n/no.json index f131e4fe..c0d376c5 100644 --- a/i18n/no.json +++ b/i18n/no.json @@ -130,6 +130,7 @@ "Markdown": "Oppmerket", "Download attachment": "Last ned vedlegg", "Cloned: '%s'": "Kopier: '%s'", + "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.", "Attach a file": "Legg til fil", "Remove attachment": "Slett vedlegg", "Your browser does not support uploading encrypted files. Please use a newer browser.": diff --git a/i18n/oc.json b/i18n/oc.json index 8f923b1b..90478768 100644 --- a/i18n/oc.json +++ b/i18n/oc.json @@ -139,6 +139,7 @@ "Markdown": "Markdown", "Download attachment": "Telecargar la pèça junta", "Cloned: '%s'": "Clonar: '%s'", + "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.", "Attach a file": "Juntar un fichièr ", "Remove attachment": "Levar la pèca junta", "Your browser does not support uploading encrypted files. Please use a newer browser.": diff --git a/i18n/pl.json b/i18n/pl.json index b722c480..82d9b579 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -130,6 +130,7 @@ "Markdown": "Markdown", "Download attachment": "Pobierz załącznik", "Cloned: '%s'": "Sklonowano: '%s'", + "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.", "Attach a file": "Załącz plik", "Remove attachment": "Usuń załącznik", "Your browser does not support uploading encrypted files. Please use a newer browser.": diff --git a/i18n/pt.json b/i18n/pt.json index 01d5dfe8..6af67cf6 100644 --- a/i18n/pt.json +++ b/i18n/pt.json @@ -130,6 +130,7 @@ "Markdown": "Markdown", "Download attachment": "Baixar anexo", "Cloned: '%s'": "Clonado: '%s'", + "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.", "Attach a file": "Anexar um arquivo", "Remove attachment": "Remover anexo", "Your browser does not support uploading encrypted files. Please use a newer browser.": diff --git a/i18n/ru.json b/i18n/ru.json index 53431ad2..989d3e4f 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -110,8 +110,6 @@ "неизвестная причина", "server error or not responding": "ошибка сервера или нет ответа", - "unknown error": - "неизвестная ошибка", "Could not post comment: %s": "Не удалось опубликовать комментарий: %s", "Please move your mouse for more entropy…": diff --git a/i18n/sl.json b/i18n/sl.json index 4c0a7e9f..21db8c1d 100644 --- a/i18n/sl.json +++ b/i18n/sl.json @@ -139,6 +139,7 @@ "Markdown": "Markdown", "Download attachment": "Pretoči priponko", "Cloned: '%s'": "'%s' klonirana", + "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.", "Attach a file": "Pripni datoteko", "Remove attachment": "Odstrani priponko", "Your browser does not support uploading encrypted files. Please use a newer browser.": diff --git a/tst/I18nTest.php b/tst/I18nTest.php index 187fd1a2..c7ded0ee 100644 --- a/tst/I18nTest.php +++ b/tst/I18nTest.php @@ -146,19 +146,31 @@ class I18nTest extends PHPUnit_Framework_TestCase public function testMessageIdsExistInAllLanguages() { $messageIds = array(); - $languages = array(); - $dir = dir(PATH . 'i18n'); + $languages = array(); + $dir = dir(PATH . 'i18n'); while (false !== ($file = $dir->read())) { if (strlen($file) === 7) { - $language = substr($file, 0, 2); - $translations = json_decode(file_get_contents(PATH . 'i18n' . DIRECTORY_SEPARATOR . $file), true); - $messageIds = array_unique($messageIds + array_keys($translations)); - $languages[$language] = $translations; + $language = substr($file, 0, 2); + $languageMessageIds = array_keys( + json_decode( + file_get_contents(PATH . 'i18n' . DIRECTORY_SEPARATOR . $file), + true + ) + ); + $messageIds = array_unique(array_merge($messageIds, $languageMessageIds)); + $languages[$language] = $languageMessageIds; } } foreach ($messageIds as $messageId) { foreach (array_keys($languages) as $language) { - $this->assertArrayHasKey($messageId, $languages[$language], "message ID '$messageId' exists in translation file $language.json"); + // most languages don't translate the data size units, ignore those + if ($messageId !== 'B' && strlen($messageId) !== 3 && strpos($messageId, 'B', 2) !== 2) { + $this->assertContains( + $messageId, + $languages[$language], + "message ID '$messageId' exists in translation file $language.json" + ); + } } } } From 3fc6ede5bbc32d61826d53ddfe0b478c474148b2 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 25 Mar 2017 09:26:31 -0300 Subject: [PATCH 3/5] Translate missing IDs to Portuguese As referenced on issue #201, some IDs were missing from the pt translation, which were now translated. --- i18n/pt.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/i18n/pt.json b/i18n/pt.json index 6af67cf6..05ce23d1 100644 --- a/i18n/pt.json +++ b/i18n/pt.json @@ -130,7 +130,7 @@ "Markdown": "Markdown", "Download attachment": "Baixar anexo", "Cloned: '%s'": "Clonado: '%s'", - "The cloned file '%s' was attached to this paste.": "The cloned file '%s' was attached to this paste.", + "The cloned file '%s' was attached to this paste.": "O arquivo clonado '%s' foi anexado a essa cópia.", "Attach a file": "Anexar um arquivo", "Remove attachment": "Remover anexo", "Your browser does not support uploading encrypted files. Please use a newer browser.": @@ -147,9 +147,9 @@ "Enter password": "Digite a senha", "Loading…": "Carregando…", - "Decrypting paste…": "Decrypting paste…", - "Preparing new paste…": "Preparing new paste…", + "Decrypting paste…": "Decifrando cópia…", + "Preparing new paste…": "Preparando nova cópia…", "In case this message never disappears please have a look at this FAQ for information to troubleshoot.": "Caso essa mensagem nunca desapareça, por favor veja este FAQ para saber como resolver os problemas.", - "+++ no paste text +++": "+++ no paste text +++" + "+++ no paste text +++": "+++ sem texto de cópia +++" } From 82e45915c73b566a1247c459fcbbd785c783d747 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Sat, 25 Mar 2017 17:06:56 +0300 Subject: [PATCH 4/5] Update Russian translation --- i18n/ru.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i18n/ru.json b/i18n/ru.json index 989d3e4f..da462c38 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -93,7 +93,7 @@ "Anonymous": "Аноним", "Avatar generated from IP address": - "Анонимный аватар (Vizhash IP адреса)", + "Аватар, сгенерированный из IP-адреса", "Add comment": "Добавить комментарий", "Optional nickname…": @@ -105,7 +105,7 @@ "Comment posted.": "Комментарий опубликован.", "Could not refresh display: %s": - "Could not refresh display: %s", + "Не удалось обновить отображение: %s", "unknown status": "неизвестная причина", "server error or not responding": From cd40717301125d8a4cf638b81395b6f18733ccfc Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 25 Mar 2017 18:44:20 +0100 Subject: [PATCH 5/5] fixing #209, refactoring regression when file upload is disabled --- js/privatebin.js | 3 ++- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index c55a0271..65d81878 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2082,7 +2082,8 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { */ me.hasAttachment = function() { - return ($attachmentLink.prop('href') !== '') + var link = $attachmentLink.prop('href'); + return (typeof link !== 'undefined' && link !== '') } /** diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 5381863b..e1df5d7e 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -69,7 +69,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index 18d60e32..c38a1ebb 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -47,7 +47,7 @@ if ($MARKDOWN): - +