Index: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate.i18n.php |
— | — | @@ -0,0 +1,375 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Internationalization file for the Live Translate extension. |
| 6 | + * |
| 7 | + * @file LiveTranslate.i18n.php |
| 8 | + * @ingroup LiveTranslate |
| 9 | + * |
| 10 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 11 | + */ |
| 12 | + |
| 13 | +$messages = array(); |
| 14 | + |
| 15 | +/** English |
| 16 | + * @author Jeroen De Dauw |
| 17 | + */ |
| 18 | +$messages['en'] = array( |
| 19 | + 'livetranslate-desc' => 'Enables live translation of page content using the Google Translate service', |
| 20 | + |
| 21 | + // Translation interface |
| 22 | + 'livetranslate-translate-to' => 'Translate this page to', |
| 23 | + 'livetranslate-button-translate' => 'Translate', |
| 24 | + 'livetranslate-button-translating' => 'Translating...', |
| 25 | + 'livetranslate-button-revert' => 'Show original', |
| 26 | + 'livetranslate-dictionary-error' => 'Could not obtain the live translate dictionary. No words will be treated as special during the translation process.', |
| 27 | + |
| 28 | + // Special words dictionary |
| 29 | + 'livetranslate-dictionary-empty' => 'There are no words in the dictionary yet. Click the "edit" tab to add some.', |
| 30 | + 'livetranslate-dictionary-count' => 'There {{PLURAL:$1|is $1 word|are $1 words}} in $2 {{PLURAL:$2|language|languages}}. Click the "edit" tab to add more.', |
| 31 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|This language is|These languages are}} not currently set as allowed translation target: $1. Modify the allowed languages in your wikis configuration, or remove these from the dictionary.' |
| 32 | +); |
| 33 | + |
| 34 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
| 35 | + * @author EugeneZelenko |
| 36 | + * @author Jim-by |
| 37 | + * @author Wizardist |
| 38 | + */ |
| 39 | +$messages['be-tarask'] = array( |
| 40 | + 'livetranslate-desc' => 'Дазваляе пераклады тэкстаў старонак на ляту ў Google Translate', |
| 41 | + 'livetranslate-translate-to' => 'Перакласьці гэту старонку на', |
| 42 | + 'livetranslate-button-translate' => 'Перакласьці', |
| 43 | + 'livetranslate-button-translating' => 'Ідзе пераклад…', |
| 44 | + 'livetranslate-button-revert' => 'Паказаць арыгінал', |
| 45 | + 'livetranslate-dictionary-error' => 'Немагчыма атрымаць слоўнік перакладу на ляту. Няма словаў, якая будуць разглядацца як спэцыяльныя, падчас працэсу перакладу.', |
| 46 | + 'livetranslate-dictionary-empty' => 'Пакуль што няма словаў у слоўніку. Націсьніце кнопку «рэдагаваць» каб дадаць.', |
| 47 | + 'livetranslate-dictionary-count' => 'Ёсьць $1 {{PLURAL:$1|слова|словы|словаў}} у $2 {{PLURAL:$2|мове|мовах|мовах}}. Націсьніце кнопку «рэдагаваць» каб дадаць болей.', |
| 48 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Гэтая мова не дазволеная|Гэтыя мовы не дазволеныя}} у цяперашні момант як мэтавыя для перакладу: $1. Зьмяніце дазволеныя мовы ў Вашых наладах {{GRAMMAR:родны|{{SITENAME}}}}, ці выдаліце са слоўніка.', |
| 49 | +); |
| 50 | + |
| 51 | +/** Bulgarian (Български) |
| 52 | + * @author DCLXVI |
| 53 | + */ |
| 54 | +$messages['bg'] = array( |
| 55 | + 'livetranslate-button-translate' => 'Превеждане', |
| 56 | + 'livetranslate-button-translating' => 'Превеждане...', |
| 57 | +); |
| 58 | + |
| 59 | +/** Breton (Brezhoneg) |
| 60 | + * @author Fulup |
| 61 | + */ |
| 62 | +$messages['br'] = array( |
| 63 | + 'livetranslate-desc' => 'Aotren a ra treiñ danvez ur bajenn war-eeun en ur ober gant servij treiñ Google', |
| 64 | +); |
| 65 | + |
| 66 | +/** Bosnian (Bosanski) |
| 67 | + * @author CERminator |
| 68 | + */ |
| 69 | +$messages['bs'] = array( |
| 70 | + 'livetranslate-desc' => 'Omogućuje prevođenje uživo sadržaja stranice koristeći uslugu Google Translate', |
| 71 | + 'livetranslate-translate-to' => 'Prevedi ovu stranicu na', |
| 72 | + 'livetranslate-button-translate' => 'Prevedi', |
| 73 | + 'livetranslate-button-translating' => 'Prevodim...', |
| 74 | + 'livetranslate-button-revert' => 'Prikaži original', |
| 75 | + 'livetranslate-dictionary-error' => 'Ne može se pronaći rječnik za prevođenje uživo. Nijedna riječ neće biti posmatrana posebno tokom procesa prevođenja.', |
| 76 | + 'livetranslate-dictionary-empty' => "Još uvijek nema riječi u rječniku. Kliknite na jezičak ''uredi'' da ih dodate.", |
| 77 | + 'livetranslate-dictionary-count' => 'Ima {{PLURAL:$1|$1 riječ|$1 riječi}} na $2 {{PLURAL:$2|jeziku|jezika}}. Kliknite na jezičak "uredi" da dodate više.', |
| 78 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Ovaj jezik nije|Ovi jezici nisu}} trenutno {{PLURAL:$2|postavljen|postavljeni}} kao dopušteni cilj prevođenja: $1. Promijenite dopuštene jezike u vašim postavkama wikija ili uklonite ove iz rječnika.', |
| 79 | +); |
| 80 | + |
| 81 | +/** German (Deutsch) |
| 82 | + * @author Kghbln |
| 83 | + */ |
| 84 | +$messages['de'] = array( |
| 85 | + 'livetranslate-desc' => 'Ermöglicht die unmittelbare Übersetzung des Seiteninhalts mit „Google Übersetzer“', |
| 86 | + 'livetranslate-translate-to' => 'Diese Seite in folgende Sprache übersetzen:', |
| 87 | + 'livetranslate-button-translate' => 'Übersetze', |
| 88 | + 'livetranslate-button-translating' => 'Übersetze …', |
| 89 | + 'livetranslate-button-revert' => 'Originalinhalt anzeigen', |
| 90 | + 'livetranslate-dictionary-error' => 'Das Wörterbuch konnte nicht geladen werden. Daher werden die in ihm enthaltenen Wörter nicht während des Übersetzungsvorgangs berücksichtigt.', |
| 91 | + 'livetranslate-dictionary-empty' => 'Momentan befinden sich keine Vokabeln im Wörterbuch. Auf „Bearbeiten“ klicken, um welche hinzuzufügen.', |
| 92 | + 'livetranslate-dictionary-count' => 'Momentan {{PLURAL:$1|befindet sich $1 Wort|befinden sich $1 Wörter}} in $2 {{PLURAL:$2|Sprache|Sprachen}} im Wörterbuch. Auf „Bearbeiten“ klicken, um weitere hinzuzufügen.', |
| 93 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Diese Sprache ist|Diese Sprachen sind}} momentan nicht zum Übersetzen zugelassen: $1. Entweder nun die Einstellung der übersetzbaren Sprachen in der Wikikonfiguration anpassen oder diese aus dem Wörterbuch entfernen.', |
| 94 | +); |
| 95 | + |
| 96 | +/** Lower Sorbian (Dolnoserbski) |
| 97 | + * @author Michawiki |
| 98 | + */ |
| 99 | +$messages['dsb'] = array( |
| 100 | + 'livetranslate-desc' => 'Zmóžnja direktne pśełožowanje wopśimjeśa boka z pomocu słužby "Google Translate"', |
| 101 | + 'livetranslate-translate-to' => 'Pśełož toś ten boko do', |
| 102 | + 'livetranslate-button-translate' => 'Pśełožyś', |
| 103 | + 'livetranslate-button-translating' => 'Pśełožujo se...', |
| 104 | + 'livetranslate-button-revert' => 'Original pokazaś', |
| 105 | + 'livetranslate-dictionary-error' => 'Słownik za Live Translate njedajo se zacytaś. Jogo słowa njezapśimuju se za pśełožowański proces.', |
| 106 | + 'livetranslate-dictionary-empty' => 'Hyšći njejsu žedne słowa w słowniku. Klikni na rejtark "wobźěłaś", aby někotare dodał.', |
| 107 | + 'livetranslate-dictionary-count' => '{{PLURAL:$1|Jo $1 słowo|Stej $1 słowje|Su $1 słowa|Jo $1 słowow}} w $2 {{PLURAL:$2|rěcy|rěcoma|rěcach|rěcach}}. Klikni na rejterk "wobźěłaś", aby dalšne dodał.', |
| 108 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Toś ta rěc njejo|Toś tej rěcy njejstej|Toś te rěcy njejsu|Toś te rěcy njejsu}} tuchylu ako dowólony pśełožowański cel {{PLURAL:$2|nastajona|nastajonej|nastajone|nastajone}}: $1. Změń dowólone rěcy w konfiguraciji twójogo wikija abo wótpóraj te ze słownika.', |
| 109 | +); |
| 110 | + |
| 111 | +/** Basque (Euskara) |
| 112 | + * @author An13sa |
| 113 | + */ |
| 114 | +$messages['eu'] = array( |
| 115 | + 'livetranslate-button-translate' => 'Itzuli', |
| 116 | + 'livetranslate-button-translating' => 'Itzultzen...', |
| 117 | + 'livetranslate-button-revert' => 'Jatorrizkoa erakutsi', |
| 118 | +); |
| 119 | + |
| 120 | +/** French (Français) |
| 121 | + * @author Crochet.david |
| 122 | + * @author Sherbrooke |
| 123 | + */ |
| 124 | +$messages['fr'] = array( |
| 125 | + 'livetranslate-desc' => 'Permet la traduction immédiate du contenu de la page en utilisant le service de traduction de Google', |
| 126 | + 'livetranslate-translate-to' => 'Traduire cette page en', |
| 127 | + 'livetranslate-button-translate' => 'Traduire', |
| 128 | + 'livetranslate-button-translating' => 'Traduction en cours...', |
| 129 | + 'livetranslate-button-revert' => 'Afficher l’original', |
| 130 | + 'livetranslate-dictionary-error' => "Impossible d'obtenir la traduction immédiate du dictionnaire. Aucun mot ne recevra de traitement spécial pendant le processus de traduction.", |
| 131 | + 'livetranslate-dictionary-empty' => "Il n'y a aucun mot dans le dictionnaire encore. Cliquez sur l'onglet « Modifier » pour en ajouter.", |
| 132 | + 'livetranslate-dictionary-count' => "Il y a $1 {{PLURAL:$1|mot|mots}} dans {{PLURAL:$2|une langue|$2 langues}}. Cliquez sur l'onglet « Modifier » pour en ajouter.", |
| 133 | + 'livetranslate-dictionary-unallowed-langs' => "{{PLURAL:$2|Cette langue n'est|Ces langues ne sont}} pas sélectionnées comme {{PLURAL:$2|langue cible|langues cibles}} : $1. Modifiez les langues autorisées dans votre configuration de wiki ou supprimez-les du dictionnaire.", |
| 134 | +); |
| 135 | + |
| 136 | +/** Galician (Galego) |
| 137 | + * @author Toliño |
| 138 | + */ |
| 139 | +$messages['gl'] = array( |
| 140 | + 'livetranslate-desc' => 'Activa a tradución en vivo do contido dunha páxina mediante o servizo de tradución do Google', |
| 141 | + 'livetranslate-translate-to' => 'Traducir esta páxina ao', |
| 142 | + 'livetranslate-button-translate' => 'Traducir', |
| 143 | + 'livetranslate-button-translating' => 'Traducindo...', |
| 144 | + 'livetranslate-button-revert' => 'Mostrar o orixinal', |
| 145 | +); |
| 146 | + |
| 147 | +/** Swiss German (Alemannisch) |
| 148 | + * @author Als-Holder |
| 149 | + */ |
| 150 | +$messages['gsw'] = array( |
| 151 | + 'livetranslate-desc' => 'Macht di diräkt Ibersetzig vum Syteninhalt megli mit „Google Ibersetzer“', |
| 152 | + 'livetranslate-translate-to' => 'Die Syte ibersetze in', |
| 153 | + 'livetranslate-button-translate' => 'Ibersetze', |
| 154 | + 'livetranslate-button-translating' => 'Am Ibersetze …', |
| 155 | + 'livetranslate-button-revert' => 'Originalinhalt aazeige', |
| 156 | + 'livetranslate-dictionary-empty' => 'Zurzyt het s kei Vokable im Werterbuech. Uf „Bearbeite“ klicke go ne baar yyfiege.', |
| 157 | + 'livetranslate-dictionary-count' => 'Zurzyt {{PLURAL:$1|git s $1 Wort|git s $1 Werter}} in $2 {{PLURAL:$2|Sproch|Sproche}} im Werterbuech. Uf „Bearbeite“ klicke go wyteri yyfiege.', |
| 158 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Die Sproch isch|Die Sproche sin}} zurzyt nit zum Ibersetze zuegloo: $1. Entwäder jetz d Yystellig vu dr ibersetzbare Sproche in dr Wikikonfiguration aapasse oder die us em Werterbuech uuseneh.', |
| 159 | +); |
| 160 | + |
| 161 | +/** Upper Sorbian (Hornjoserbsce) |
| 162 | + * @author Michawiki |
| 163 | + */ |
| 164 | +$messages['hsb'] = array( |
| 165 | + 'livetranslate-desc' => 'Zmóžnja hnydomne přełožowanje wobsaha strony z pomocu słužby "Google Translate"', |
| 166 | + 'livetranslate-translate-to' => 'Přełož tutu stronu do', |
| 167 | + 'livetranslate-button-translate' => 'Přełožić', |
| 168 | + 'livetranslate-button-translating' => 'Přełožuje so...', |
| 169 | + 'livetranslate-button-revert' => 'Original pokazać', |
| 170 | + 'livetranslate-dictionary-error' => 'Słownik za Live Translate njeda so začitać. Jeho słowa so za přełožowanski proces njewobkedźbuja.', |
| 171 | + 'livetranslate-dictionary-empty' => 'Hišće žane słowa w słowniku njejsu. Klikń na rajtark "wobdźěłać", zo by někotre přidał.', |
| 172 | + 'livetranslate-dictionary-count' => '{{PLURAL:$1|Je $1 słowo|Stej $1 słowje|Su $1 słowa|Je $1 słowow}} w $2 {{PLURAL:$2|rěči|rěčomaj|rěčach|rěčach}}. Klikń na rajtark $wobdźěłać", zo by dalše přidał.', |
| 173 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Tuta rěč njeje |Tutej rěči njejstej|Tute rěče njejsu|Tute rěče njejsu}} tuchwilu jako dowoleny přełožowanski cil {{PLURAL:$2|nastajena|nastajenej|nastajene|nastajene}}: $1. Změń dowolene rěče w konfiguraciji twojeho wikija abo wotstroń je ze słownika.', |
| 174 | +); |
| 175 | + |
| 176 | +/** Interlingua (Interlingua) |
| 177 | + * @author McDutchie |
| 178 | + */ |
| 179 | +$messages['ia'] = array( |
| 180 | + 'livetranslate-desc' => 'Permitte le traduction in directo de contento de paginas usante le servicio Google Translate', |
| 181 | + 'livetranslate-translate-to' => 'Traducer iste pagina in', |
| 182 | + 'livetranslate-button-translate' => 'Traducer', |
| 183 | + 'livetranslate-button-translating' => 'Traduction in curso...', |
| 184 | + 'livetranslate-button-revert' => 'Monstrar original', |
| 185 | + 'livetranslate-dictionary-error' => 'Non poteva obtener le dictionario de traduction in directo. Nulle parola essera tractate como special durante le processo de traduction.', |
| 186 | + 'livetranslate-dictionary-empty' => 'Le dictionario non ha ancora parolas. Clicca sur le scheda "modificar" pro adder alcunes.', |
| 187 | + 'livetranslate-dictionary-count' => 'Il ha {{PLURAL:$1|$1 parola|$1 parolas}} in $2 {{PLURAL:$2|linguas|linguas}}. Clicca sur le scheda "modificar" pro adder alteres.', |
| 188 | + 'livetranslate-dictionary-unallowed-langs' => 'Iste {{PLURAL:$2|lingua|linguas}} non es actualmente definite como destinationes valide pro traduction: $1. Modifica le linguas permittite in le configuration de tu wiki, o remove istes del dictionario.', |
| 189 | +); |
| 190 | + |
| 191 | +/** Indonesian (Bahasa Indonesia) |
| 192 | + * @author IvanLanin |
| 193 | + */ |
| 194 | +$messages['id'] = array( |
| 195 | + 'livetranslate-desc' => 'Memungkinkan penerjemahan langsung konten halaman dengan menggunakan layanan Google Terjemahan', |
| 196 | + 'livetranslate-translate-to' => 'Terjemahkan halaman ini ke', |
| 197 | + 'livetranslate-button-translate' => 'Terjemahkan', |
| 198 | + 'livetranslate-button-translating' => 'Menerjemahkan ...', |
| 199 | + 'livetranslate-button-revert' => 'Tampilkan yang asli', |
| 200 | + 'livetranslate-dictionary-error' => 'Tidak dapat memperoleh kamus penerjemahan langsung. Tidak ada kata yang diperlakukan secara khusus selama proses penerjemahan.', |
| 201 | + 'livetranslate-dictionary-empty' => 'Belum tersedia kata dalam kamus. Klik tab "sunting" untuk menambahkan.', |
| 202 | + 'livetranslate-dictionary-count' => 'Ada {{PLURAL:$1|$1 kata|$1 kata}} dalam $2 {{PLURAL:$2|bahasa|bahasa}}. Klik tab "sunting" untuk menambakan.', |
| 203 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Bahasa ini|Bahasa-bahasa ini}} disetel sebagai target terjemahan: $1. Ubah bahasa yang diizinkan dalam konfigurasi wiki, atau hapus dari kamus.', |
| 204 | +); |
| 205 | + |
| 206 | +/** Italian (Italiano) |
| 207 | + * @author Beta16 |
| 208 | + */ |
| 209 | +$messages['it'] = array( |
| 210 | + 'livetranslate-button-translate' => 'Traduci', |
| 211 | + 'livetranslate-button-translating' => 'Traduzione in corso...', |
| 212 | +); |
| 213 | + |
| 214 | +/** Japanese (日本語) |
| 215 | + * @author Ohgi |
| 216 | + */ |
| 217 | +$messages['ja'] = array( |
| 218 | + 'livetranslate-translate-to' => 'このページを翻訳', |
| 219 | + 'livetranslate-button-translate' => '翻訳', |
| 220 | + 'livetranslate-button-translating' => '翻訳中...', |
| 221 | +); |
| 222 | + |
| 223 | +/** Luxembourgish (Lëtzebuergesch) |
| 224 | + * @author Robby |
| 225 | + */ |
| 226 | +$messages['lb'] = array( |
| 227 | + 'livetranslate-desc' => 'Erméiglecht d\'live Iwwersetzen vu Säiteninhalt mam Service "Google Translate"', |
| 228 | + 'livetranslate-translate-to' => 'Iwwersetzt dës Säit op', |
| 229 | + 'livetranslate-button-translate' => 'Iwwersetzen', |
| 230 | + 'livetranslate-button-translating' => 'Iwwersetzen...', |
| 231 | + 'livetranslate-button-revert' => "D'Original weisen", |
| 232 | + 'livetranslate-dictionary-error' => 'De Live-Iwwersetzungs-Dictionnaire gouf net fonnt. Keng Wierder gi bei der Iwwersetzung als spezial ugekuckt.', |
| 233 | + 'livetranslate-dictionary-empty' => 'Et gëtt nach keng Wierder am Dictionnaire. Klickt op den "Änneren"-Tab fir der derbäizesetzen.', |
| 234 | + 'livetranslate-dictionary-count' => 'Et gëtt {{PLURAL:$1|ee Wuert|$1 Wierder}} a(n) {{PLURAL:$2|enger Sprooch|$2 Sproochen}}. Klickt den "Änneren"-Tab fir der derbäizesetzen.', |
| 235 | + 'livetranslate-dictionary-unallowed-langs' => "Dës {{PLURAL:$2|Sprooch ass|Sprooche si}} momentan net fir d'Iwwersetzen zougelooss: $1. Entweder ännert d'Astellung vun den erlaabte Sproochen an Ärer Wiki-Konfiguratioun oder huelt se aus dem Dictionnaire eraus.", |
| 236 | +); |
| 237 | + |
| 238 | +/** Macedonian (Македонски) |
| 239 | + * @author Bjankuloski06 |
| 240 | + */ |
| 241 | +$messages['mk'] = array( |
| 242 | + 'livetranslate-desc' => 'Овозможува преведување на содржината на една страница во живо, користејќи Google Translate', |
| 243 | + 'livetranslate-translate-to' => 'Преведи ја страницава на', |
| 244 | + 'livetranslate-button-translate' => 'Преведи', |
| 245 | + 'livetranslate-button-translating' => 'Преведувам...', |
| 246 | + 'livetranslate-button-revert' => 'Прикажи изворно', |
| 247 | + 'livetranslate-dictionary-error' => 'Не можев да го добијам речникот за преведување во живо. Ниеден збор нема да се смета за посебен во текот на преводната постапка.', |
| 248 | + 'livetranslate-dictionary-empty' => 'Сè уште нема зборови во речникот. Стиснете на јазичето „уреди“ и додајте некои.', |
| 249 | + 'livetranslate-dictionary-count' => 'Има {{PLURAL:$1|$1 збор|$1 збора}} на $2 {{PLURAL:$2|јазик|јазици}}. Ситиснете на јазичето „уреди“ за да додадете уште.', |
| 250 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Овој јазик моментално не е зададен|Овие јазици моментално не се зададени}} како допуштена преводна одредница: $1. Изменете ги допуштените јазици во вики-поставките, или пак отстранете ги постоечкиве од речникот.', |
| 251 | +); |
| 252 | + |
| 253 | +/** Dutch (Nederlands) |
| 254 | + * @author McDutchie |
| 255 | + * @author SPQRobin |
| 256 | + * @author Siebrand |
| 257 | + */ |
| 258 | +$messages['nl'] = array( |
| 259 | + 'livetranslate-desc' => 'Maakt het mogelijk paginainhoud live te vertalen met behulp van de dienst Google Translate', |
| 260 | + 'livetranslate-translate-to' => 'Pagina vertalen in het', |
| 261 | + 'livetranslate-button-translate' => 'Vertalen', |
| 262 | + 'livetranslate-button-translating' => 'Bezig met vertalen...', |
| 263 | + 'livetranslate-button-revert' => 'Origineel weergeven', |
| 264 | + 'livetranslate-dictionary-error' => 'Het was niet mogelijk het woordenboek voor livevertaling op te halen. Er zijn geen woorden die een speciale behandeling krijgen tijdens het vertaalproces.', |
| 265 | + 'livetranslate-dictionary-empty' => 'Er zijn nog geen woorden in het woordenboek. Klik op de tab "bewerken" om woorden toe te voegen.', |
| 266 | + 'livetranslate-dictionary-count' => 'Er {{PLURAL:$1|is één woord|zijn $1 woorden}} in $2 {{PLURAL:$2|taal|talen}}. Klik op de tab "bewerken" om meer woorden toe te voegen.', |
| 267 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Deze taal is|Deze taken zijn}} niet ingesteld als toegestane doeltaal: $1. Wijzig te toegestane talen in de instellingen van uw wiki of verwijder ze uit het woordenboek.', |
| 268 | +); |
| 269 | + |
| 270 | +/** Norwegian (bokmål) (Norsk (bokmål)) |
| 271 | + * @author Nghtwlkr |
| 272 | + */ |
| 273 | +$messages['no'] = array( |
| 274 | + 'livetranslate-desc' => 'Aktiverer live-oversettelse av sideinnhold ved hjelp av tjenesten Google Translate', |
| 275 | + 'livetranslate-translate-to' => 'Oversett denne siden til', |
| 276 | + 'livetranslate-button-translate' => 'Oversett', |
| 277 | + 'livetranslate-button-translating' => 'Oversetter...', |
| 278 | + 'livetranslate-button-revert' => 'Vis opprinnelig', |
| 279 | + 'livetranslate-dictionary-error' => 'Kunne ikke få tak i sanntidsoversettelsesordlisten. Ingen ord vil bli behandlet som spesielle under oversettelsesprosessen.', |
| 280 | + 'livetranslate-dictionary-empty' => 'Det er ingen ord i ordlisten ennå. Klikk på «rediger»-fanen for å legge til noen.', |
| 281 | + 'livetranslate-dictionary-count' => 'Det er {{PLURAL:$1|ett ord|$1 ord}} i $2 {{PLURAL:$2|språk|språk}}. Klikk på «rediger»-fanen for å legge til flere.', |
| 282 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Dette språket|Disse språkene}} er for øyeblikket ikke satt som tillatte oversettelsesmål: $1. Endre tillatte språk i din wikis konfigurasjon eller fjern disse fra ordlisten.', |
| 283 | +); |
| 284 | + |
| 285 | +/** Polish (Polski) |
| 286 | + * @author Byulent |
| 287 | + * @author Sp5uhe |
| 288 | + */ |
| 289 | +$messages['pl'] = array( |
| 290 | + 'livetranslate-desc' => 'Włącza tłumaczenie zawartości strony na żywo z wykorzystaniem serwisu tłumaczącego Google', |
| 291 | + 'livetranslate-translate-to' => 'Przetłumacz tę stronę na', |
| 292 | + 'livetranslate-button-translate' => 'Tłumacz', |
| 293 | + 'livetranslate-button-translating' => 'Tłumaczenie...', |
| 294 | + 'livetranslate-button-revert' => 'Pokaż w oryginale', |
| 295 | + 'livetranslate-dictionary-error' => 'Nie można uzyskać dostępu na żywo do słownika tłumaczącego. Żadne słowo nie będzie traktowane specjalnie w czasie wykonywania tłumaczenia.', |
| 296 | + 'livetranslate-dictionary-empty' => 'Na razie brak jest jeszcze słów w słowniku. Kliknij zakładkę „Edytuj“ aby jakieś dodać.', |
| 297 | + 'livetranslate-dictionary-count' => '{{PLURAL:$1|Jest $1 słowo|Są $1 słowa|Jest $1 słów}} w $2 {{PLURAL:$2|języku|językach}}. Kliknij zakładkę „Edytuj“ aby dodać następne.', |
| 298 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Język $1 nie jest obecnie dostępny jako docelowy|Języki $1 nie są obecnie dostępne jako docelowe}} dla tłumaczeń. Zmień dopuszczalne języki w konfiguracji swojej wiki lub usuń to ze słownika.', |
| 299 | +); |
| 300 | + |
| 301 | +/** Piedmontese (Piemontèis) |
| 302 | + * @author Dragonòt |
| 303 | + */ |
| 304 | +$messages['pms'] = array( |
| 305 | + 'livetranslate-desc' => 'A abìlita viragi dal viv ëd contnù ëd pàgine an dovrand ël sërvissi Google Translate', |
| 306 | + 'livetranslate-translate-to' => 'Vòlta sta pàgina an', |
| 307 | + 'livetranslate-button-translate' => 'Traduv', |
| 308 | + 'livetranslate-button-translating' => 'Volté...', |
| 309 | + 'livetranslate-button-revert' => 'Mosta original', |
| 310 | + 'livetranslate-dictionary-error' => 'As peul pa avèj ël dissionari ëd viragi viv. Pa gnun-e paròle a saran tratà com speciaj an mente dël process ëd viragi.', |
| 311 | + 'livetranslate-dictionary-empty' => 'A-i é pa anco\' gnun-e paròle ant ël dissionari. Sgnaca ël boton "modìfica" për giuntene quaidun-e.', |
| 312 | + 'livetranslate-dictionary-count' => 'A-i {{PLURAL:$1|é $1 paròla|son $1 paròle}} an $2 {{PLURAL:$2|lenga|lenghe}}. Sgnaca ël boton "modìfica" për giontene ëd pi.', |
| 313 | + 'livetranslate-dictionary-unallowed-langs' => "{{PLURAL:$2|Sta lenga a l'é|Ste lenghe a son}} al moment pa ampostà com obietiv përmëttù ed viragi: $1. Modìfica le lenghe përmëttùe ant la configurassion ëd toe wiki, o gav-je dal dissionari.", |
| 314 | +); |
| 315 | + |
| 316 | +/** Portuguese (Português) |
| 317 | + * @author Hamilton Abreu |
| 318 | + */ |
| 319 | +$messages['pt'] = array( |
| 320 | + 'livetranslate-desc' => 'Permite a tradução imediata do conteúdo das páginas usando o serviço Google Translate', |
| 321 | + 'livetranslate-translate-to' => 'Traduzir esta página para', |
| 322 | + 'livetranslate-button-translate' => 'Traduzir', |
| 323 | + 'livetranslate-button-translating' => 'A traduzir...', |
| 324 | + 'livetranslate-button-revert' => 'Mostrar original', |
| 325 | + 'livetranslate-dictionary-error' => 'Não foi possível obter o dicionário de tradução imediata. Durante o processo de tradução, nenhuma palavra será considerada especial.', |
| 326 | + 'livetranslate-dictionary-empty' => 'Ainda não existem palavras no dicionário. Clique o separador "editar" para adicionar algumas.', |
| 327 | + 'livetranslate-dictionary-count' => '{{PLURAL:$1|Existe $1 palavra|Existem $1 palavras}} de $2 {{PLURAL:$2|língua|línguas}}. Clique o separador "editar" para acrescentar mais.', |
| 328 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Esta língua não está definida como destino válido|Estas línguas não estão definidas como destinos válidos}} para tradução: $1. Altere na configuração da wiki as línguas permitidas, ou remova estas do dicionário.', |
| 329 | +); |
| 330 | + |
| 331 | +/** Brazilian Portuguese (Português do Brasil) |
| 332 | + * @author Giro720 |
| 333 | + */ |
| 334 | +$messages['pt-br'] = array( |
| 335 | + 'livetranslate-desc' => 'Permite a tradução imediata do conteúdo das páginas usando o serviço Google Translate', |
| 336 | + 'livetranslate-translate-to' => 'Traduzir esta página para', |
| 337 | + 'livetranslate-button-translate' => 'Traduzir', |
| 338 | + 'livetranslate-button-translating' => 'Traduzindo...', |
| 339 | +); |
| 340 | + |
| 341 | +/** Russian (Русский) |
| 342 | + * @author Byulent |
| 343 | + * @author MaxSem |
| 344 | + * @author Александр Сигачёв |
| 345 | + */ |
| 346 | +$messages['ru'] = array( |
| 347 | + 'livetranslate-desc' => 'Включает перевод текста страницы на лету с помощью службы переводов Google', |
| 348 | + 'livetranslate-translate-to' => 'Перевести эту страницу на', |
| 349 | + 'livetranslate-button-translate' => 'Перевести', |
| 350 | + 'livetranslate-button-translating' => 'Выполняется перевод...', |
| 351 | + 'livetranslate-button-revert' => 'Показать оригинал', |
| 352 | + 'livetranslate-dictionary-error' => 'Не удалось получить словарь живого перевода. Нет слов, которые будут рассматриваться как специальные во время процесса перевода.', |
| 353 | + 'livetranslate-dictionary-empty' => 'В словаре ещё нет слов. Нажмите «править», чтобы добавить несколько.', |
| 354 | + 'livetranslate-dictionary-count' => '$1 {{PLURAL:$1|слово|слова|слов}} на $2 {{PLURAL:$2|языке|языках|языках}}. Нажмите «править», чтобы добавить ещё.', |
| 355 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Этот язык|Эти языки}} не разрешено использовать в качестве цели перевода: $1. Измените разрешения в настройках вашей вики, или удалите их из словаря.', |
| 356 | +); |
| 357 | + |
| 358 | +/** Telugu (తెలుగు) |
| 359 | + * @author Veeven |
| 360 | + */ |
| 361 | +$messages['te'] = array( |
| 362 | + 'livetranslate-translate-to' => 'ఈ పుటని అనువదించండి', |
| 363 | + 'livetranslate-button-translate' => 'అనువదించు', |
| 364 | + 'livetranslate-button-translating' => 'అనువదిస్తున్నాం...', |
| 365 | +); |
| 366 | + |
| 367 | +/** Ukrainian (Українська) |
| 368 | + * @author Тест |
| 369 | + */ |
| 370 | +$messages['uk'] = array( |
| 371 | + 'livetranslate-desc' => 'Робить можливим безпосередній переклад вмісту сторінки за допомогою служби Google Translate', |
| 372 | + 'livetranslate-translate-to' => 'Перекласти цю сторінку', |
| 373 | + 'livetranslate-button-translate' => 'Перекласти', |
| 374 | + 'livetranslate-button-translating' => 'Перекладаю...', |
| 375 | +); |
| 376 | + |
Property changes on: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 377 | + native |
Index: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate.php |
— | — | @@ -0,0 +1,81 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Initialization file for the Live Translate extension. |
| 6 | + * |
| 7 | + * Documentation: http://www.mediawiki.org/wiki/Extension:Live_Translate |
| 8 | + * Support http://www.mediawiki.org/wiki/Extension_talk:Live_Translate |
| 9 | + * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/LiveTranslate |
| 10 | + * |
| 11 | + * @file LiveTranslate.php |
| 12 | + * @ingroup LiveTranslate |
| 13 | + * |
| 14 | + * @licence GNU GPL v3 |
| 15 | + * |
| 16 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 17 | + */ |
| 18 | + |
| 19 | +/** |
| 20 | + * This documenation group collects source code files belonging to Live Translate. |
| 21 | + * |
| 22 | + * @defgroup LiveTranslate Live Translate |
| 23 | + */ |
| 24 | + |
| 25 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 26 | + die( 'Not an entry point.' ); |
| 27 | +} |
| 28 | + |
| 29 | +define( 'LiveTranslate_VERSION', '0.3' ); |
| 30 | + |
| 31 | +$wgExtensionCredits['other'][] = array( |
| 32 | + 'path' => __FILE__, |
| 33 | + 'name' => 'Live Translate', |
| 34 | + 'version' => LiveTranslate_VERSION, |
| 35 | + 'author' => array( |
| 36 | + '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw] for [http://www.wikiworks.com WikiWorks]', |
| 37 | + ), |
| 38 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Live_Translate', |
| 39 | + 'descriptionmsg' => 'livetranslate-desc' |
| 40 | +); |
| 41 | + |
| 42 | +$useExtensionPath = version_compare( $wgVersion, '1.16', '>=' ) && isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath; |
| 43 | +$egLiveTranslateScriptPath = ( $useExtensionPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/LiveTranslate'; |
| 44 | +$egLiveTranslateIP = dirname( __FILE__ ); |
| 45 | +unset( $useExtensionPath ); |
| 46 | + |
| 47 | +$wgExtensionMessagesFiles['LiveTranslate'] = $egLiveTranslateIP . '/LiveTranslate.i18n.php'; |
| 48 | + |
| 49 | +$wgAutoloadClasses['LiveTranslateHooks'] = $egLiveTranslateIP . '/LiveTranslate.hooks.php'; |
| 50 | +$wgAutoloadClasses['ApiLiveTranslate'] = $egLiveTranslateIP . '/api/ApiLiveTranslate.php'; |
| 51 | +$wgAutoloadClasses['ApiQueryLiveTranslate'] = $egLiveTranslateIP . '/api/ApiQueryLiveTranslate.php'; |
| 52 | +$wgAutoloadClasses['LiveTranslateFunctions'] = $egLiveTranslateIP . '/includes/LiveTranslate_Functions.php'; |
| 53 | + |
| 54 | +$wgAPIModules['livetranslate'] = 'ApiLiveTranslate'; |
| 55 | +$wgAPIListModules['livetranslate'] = 'ApiQueryLiveTranslate'; |
| 56 | + |
| 57 | +$wgHooks['ArticleViewHeader'][] = 'LiveTranslateHooks::onArticleViewHeader'; |
| 58 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'LiveTranslateHooks::onSchemaUpdate'; |
| 59 | +$wgHooks['ArticleSaveComplete'][] = 'LiveTranslateHooks::onArticleSaveComplete'; |
| 60 | + |
| 61 | +$egLTJSMessages = array( |
| 62 | + 'livetranslate-button-translate', |
| 63 | + 'livetranslate-button-translating', |
| 64 | + 'livetranslate-dictionary-error', |
| 65 | +); |
| 66 | + |
| 67 | +// For backward compatibility with MW < 1.17. |
| 68 | +if ( is_callable( array( 'OutputPage', 'addModules' ) ) ) { |
| 69 | + $moduleTemplate = array( |
| 70 | + 'localBasePath' => dirname( __FILE__ ), |
| 71 | + 'remoteBasePath' => $egLiveTranslateScriptPath, |
| 72 | + 'group' => 'ext.livetranslate' |
| 73 | + ); |
| 74 | + |
| 75 | + $wgResourceModules['ext.livetranslate'] = $moduleTemplate + array( |
| 76 | + 'scripts' => array( 'includes/ext.livetranslate.js' ), |
| 77 | + 'dependencies' => array(), |
| 78 | + 'messages' => $egLTJSMessages |
| 79 | + ); |
| 80 | +} |
| 81 | + |
| 82 | +require_once 'LiveTranslate_Settings.php'; |
Property changes on: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 83 | + native |
Index: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate_Settings.php |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * File defining the settings for the Live Translate extension. |
| 6 | + * More info can be found at http://www.mediawiki.org/wiki/Extension:LiveTranslate#Configuration |
| 7 | + * |
| 8 | + * NOTICE: |
| 9 | + * Changing one of these settings can be done by copieng or cutting it, |
| 10 | + * and placing it in LocalSettings.php, AFTER the inclusion of Live Translate. |
| 11 | + * |
| 12 | + * @file LiveTranslate_Settings.php |
| 13 | + * @ingroup LiveTranslate |
| 14 | + * |
| 15 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 16 | + */ |
| 17 | + |
| 18 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 19 | + die( 'Not an entry point.' ); |
| 20 | +} |
| 21 | + |
| 22 | +# The name of the page on which the special words translations dirctionary is defined. |
| 23 | +$egLiveTranslateDirPage = 'Live Translate Dictionary'; |
| 24 | + |
| 25 | +# https://code.google.com/apis/console |
| 26 | +$egGoogleApiKey = ''; |
| 27 | + |
| 28 | +# A list of languages that should be available to translate to. |
| 29 | +$egLiveTranslateLanguages = array( |
| 30 | + $wgLanguageCode, |
| 31 | +); |
Property changes on: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate_Settings.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 32 | + native |
Index: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate.hooks.php |
— | — | @@ -0,0 +1,178 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Static class for hooks handled by the Live Translate extension. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file LiveTranslate.hooks.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @author Jeroen De Dauw |
| 13 | + */ |
| 14 | +final class LiveTranslateHooks { |
| 15 | + |
| 16 | + /** |
| 17 | + * Adds the translation interface to articles. |
| 18 | + * |
| 19 | + * @since 0.1 |
| 20 | + * |
| 21 | + * @param Article &$article |
| 22 | + * @param boolean $outputDone |
| 23 | + * @param boolean $useParserCache |
| 24 | + * |
| 25 | + * @return true |
| 26 | + */ |
| 27 | + public static function onArticleViewHeader( Article &$article, &$outputDone, &$useParserCache ) { |
| 28 | + global $wgOut, $wgLang, $egLiveTranslateDirPage, $egGoogleApiKey, $egLiveTranslateLanguages; |
| 29 | + |
| 30 | + $title = $article->getTitle(); |
| 31 | + |
| 32 | + $currentLang = LiveTranslateFunctions::getCurrentLang( $title ); |
| 33 | + |
| 34 | + if ( $title->getFullText() == $egLiveTranslateDirPage ) { |
| 35 | + $wordSets = LiveTranslateFunctions::parseTranslations( $article->getContent() ); |
| 36 | + |
| 37 | + if ( count( $wordSets ) == 0 ) { |
| 38 | + $wgOut->addWikiMsg( 'livetranslate-dictionary-empty' ); |
| 39 | + } |
| 40 | + else { |
| 41 | + $wgOut->addWikiMsg( |
| 42 | + 'livetranslate-dictionary-count', |
| 43 | + $wgLang->formatNum( count( $wordSets ) ) , |
| 44 | + $wgLang->formatNum( count( $wordSets[0] ) ) |
| 45 | + ); |
| 46 | + |
| 47 | + $notAllowedLanguages = array(); |
| 48 | + |
| 49 | + foreach ( $wordSets[0] as $languageCode => $translations ) { |
| 50 | + if ( !in_array( $languageCode, $egLiveTranslateLanguages ) ) { |
| 51 | + $notAllowedLanguages[] = $languageCode; |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + if ( count( $notAllowedLanguages ) > 0 ) { |
| 56 | + $languages = Language::getLanguageNames( false ); |
| 57 | + |
| 58 | + foreach ( $notAllowedLanguages as &$notAllowedLang ) { |
| 59 | + if ( array_key_exists( $notAllowedLang, $languages ) ) { |
| 60 | + $notAllowedLang = $languages[$notAllowedLang]; |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + $wgOut->addHTML( |
| 65 | + Html::element( |
| 66 | + 'span', |
| 67 | + array( 'style' => 'color:darkred' ), |
| 68 | + wfMsgExt( 'livetranslate-dictionary-unallowed-langs', 'parsemag', $wgLang->listToText( $notAllowedLanguages ), count( $notAllowedLanguages ) ) |
| 69 | + ) |
| 70 | + |
| 71 | + ); |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + $outputDone = true; |
| 76 | + } |
| 77 | + else if ( |
| 78 | + $egGoogleApiKey != '' |
| 79 | + && $article->exists() |
| 80 | + && ( count( $egLiveTranslateLanguages ) > 1 || ( count( $egLiveTranslateLanguages ) == 1 && $egLiveTranslateLanguages[0] != $currentLang ) ) ) { |
| 81 | + $wgOut->addHTML( |
| 82 | + '<span class="notranslate" id="livetranslatespan">' . |
| 83 | + Html::rawElement( |
| 84 | + 'div', |
| 85 | + array( |
| 86 | + 'id' => 'livetranslatediv', |
| 87 | + 'style' => 'display:inline; float:right', |
| 88 | + ), |
| 89 | + htmlspecialchars( wfMsg( 'livetranslate-translate-to' ) ) . |
| 90 | + ' ' . |
| 91 | + LiveTranslateFunctions::getLanguageSelector( $currentLang ) . |
| 92 | + ' ' . |
| 93 | + Html::element( |
| 94 | + 'button', |
| 95 | + array( 'id' => 'livetranslatebutton' ), |
| 96 | + wfMsg( 'livetranslate-button-translate' ) |
| 97 | + ) . |
| 98 | + ' ' . |
| 99 | + Html::element( |
| 100 | + 'button', |
| 101 | + array( 'id' => 'ltrevertbutton', 'style' => 'display:none' ), |
| 102 | + wfMsg( 'livetranslate-button-revert' ) |
| 103 | + ) |
| 104 | + ) . |
| 105 | + '</span>' |
| 106 | + ); |
| 107 | + |
| 108 | + $wgOut->addScript( |
| 109 | + Html::linkedScript( 'https://www.google.com/jsapi?key=' . htmlspecialchars( $egGoogleApiKey ) ) . |
| 110 | + Html::inlineScript( |
| 111 | + 'google.load("language", "1");' . |
| 112 | + 'var sourceLang = ' . json_encode( $currentLang ) . ';' |
| 113 | + ) |
| 114 | + ); |
| 115 | + |
| 116 | + LiveTranslateFunctions::loadJs(); |
| 117 | + } |
| 118 | + |
| 119 | + return true; |
| 120 | + } |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + /** |
| 125 | + * Schema update to set up the needed database tables. |
| 126 | + * |
| 127 | + * @since 0.1 |
| 128 | + * |
| 129 | + * @param DatabaseUpdater $updater |
| 130 | + * |
| 131 | + * @return true |
| 132 | + */ |
| 133 | + public static function onSchemaUpdate( /* DatabaseUpdater */ $updater = null ) { |
| 134 | + global $wgDBtype, $egLiveTranslateIP; |
| 135 | + |
| 136 | + if ( $wgDBtype == 'mysql' ) { |
| 137 | + // Set up the current schema. |
| 138 | + if ( $updater === null ) { |
| 139 | + global $wgExtNewTables; |
| 140 | + $wgExtNewTables[] = array( |
| 141 | + 'livetranslate', |
| 142 | + $egLiveTranslateIP . '/LiveTranslate.sql' |
| 143 | + ); |
| 144 | + } |
| 145 | + else { |
| 146 | + $updater->addExtensionUpdate( array( |
| 147 | + 'addTable', |
| 148 | + 'livetranslate', |
| 149 | + $egLiveTranslateIP . '/LiveTranslate.sql', |
| 150 | + true |
| 151 | + ) ); |
| 152 | + } |
| 153 | + } |
| 154 | + |
| 155 | + return true; |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * Handles edits to the dictionary page to save the translations into the db. |
| 160 | + * |
| 161 | + * @since 0.1 |
| 162 | + * |
| 163 | + * @return true |
| 164 | + */ |
| 165 | + public static function onArticleSaveComplete( &$article, &$user, $text, $summary, |
| 166 | + $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect = null ) { |
| 167 | + |
| 168 | + global $egLiveTranslateDirPage; |
| 169 | + |
| 170 | + $title = $article->getTitle(); |
| 171 | + |
| 172 | + if ( $title->getFullText() == $egLiveTranslateDirPage ) { |
| 173 | + LiveTranslateFunctions::saveTranslations( LiveTranslateFunctions::parseTranslations( $text ) ); |
| 174 | + } |
| 175 | + |
| 176 | + return true; |
| 177 | + } |
| 178 | + |
| 179 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 180 | + native |
Index: tags/extensions/LiveTranslate/REL_0_3/INSTALL |
— | — | @@ -0,0 +1,46 @@ |
| 2 | +These is the install file for the Live Translate extension. |
| 3 | + |
| 4 | +Extension page on mediawiki.org: http://www.mediawiki.org/wiki/Extension:Live_Translate |
| 5 | +Latest version of the install file: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/LiveTranslate/INSTALL?view=co |
| 6 | + |
| 7 | + |
| 8 | +== Installation == |
| 9 | + |
| 10 | +Once you have downloaded the code, place the ''LiveTranslate'' directory within your MediaWiki 'extensions' directory. |
| 11 | +Then add the following code to your [[Manual:LocalSettings.php|LocalSettings.php]] file: |
| 12 | + |
| 13 | +# Live Translate |
| 14 | +require_once( "$IP/extensions/LiveTranslate/LiveTranslate.php" ); |
| 15 | + |
| 16 | +After this you need to run MediaWikis update script which can be found at /maintenance/update.php. |
| 17 | + |
| 18 | +After doing this, you have installed the extension. To be able to use it in a meaningful way, you also need to take care of some configuration: |
| 19 | + |
| 20 | +== Configuration == |
| 21 | + |
| 22 | +Configuration of Live Translate is done by adding simple PHP statements to your [[Manual:LocalSettings.php|LocalSettings.php]] |
| 23 | +file. These statements need to be placed AFTER the inclusion of Live Translate. The options are listed below and their default |
| 24 | +is set in the [http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/LiveTranslate/LiveTranslate_Settings.php?view=markup Live Translate settings file]. |
| 25 | +You should NOT modify the settings file, but can have a look at it to get an idea of how to use the settings, in case the below descriptions do not suffice. |
| 26 | + |
| 27 | +=== Google API key === |
| 28 | + |
| 29 | +To be able to actually use Google Translate, you need to [https://code.google.com/apis/console get an API key] and |
| 30 | +add it to your [[LocalSettings.php]] file AFTER the inclusion of the extension. |
| 31 | + |
| 32 | +<source lang="php"> |
| 33 | +# Google API key |
| 34 | +$egGoogleApiKey = 'INSERT-YOUR-KEY-HERE'; |
| 35 | +</source> |
| 36 | + |
| 37 | +=== Available languages === |
| 38 | + |
| 39 | +You have to specify which languages users should be able to translate to. This is done by adding language codes to <code>$egLiveTranslateLanguages</code>. |
| 40 | +By default it contains only your wikis main language (as specified by <code>$wgLanguageCode</code> in [[LocalSettings.php]]). You add languages as follows: |
| 41 | + |
| 42 | +<source lang="php"> |
| 43 | +$egLiveTranslateLanguages[] = 'nl'; |
| 44 | +$egLiveTranslateLanguages[] = 'de'; |
| 45 | +</source> |
| 46 | + |
| 47 | +If there are no languages available other then the current language of the page, then the translation control will not show up. |
Index: tags/extensions/LiveTranslate/REL_0_3/RELEASE-NOTES |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +These are the release notes for the Live Translate extension. |
| 3 | + |
| 4 | +Extension page on mediawiki.org: http://www.mediawiki.org/wiki/Extension:Live_Translate |
| 5 | +Latest version of the release notes: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/LiveTranslate/RELEASE-NOTES?view=co |
| 6 | + |
| 7 | + |
| 8 | +=== Version 0.3 === |
| 9 | +2011-01-07 |
| 10 | + |
| 11 | +* Added compatibility with IE8. |
| 12 | +* Fixed issue with trim-prevention, causing |-signs to semi-randomly get inserted into translated text. |
| 13 | +* Only show the translation control when an API key is provided. |
| 14 | + |
| 15 | +=== Version 0.2 === |
| 16 | +2010-12-24 |
| 17 | + |
| 18 | +* Fixed installation compatibility issue with MW 1.16. |
| 19 | +* Fixed display of translation control to only happen on existing pages. |
| 20 | +* Fixed issues with inserting notranslatre tags into the page source. |
| 21 | + |
| 22 | +=== Version 0.1 === |
| 23 | +2010-12-22 |
| 24 | + |
| 25 | +* Added simple translation interface to the right top of articles. |
| 26 | +* Implemented translation via the Google Translate API. |
| 27 | +* Added dictionary for special words with synonyms support. |
Index: tags/extensions/LiveTranslate/REL_0_3/includes/ext.livetranslate.js |
— | — | @@ -0,0 +1,343 @@ |
| 2 | +/** |
| 3 | + * JavasSript for the Live Translate extension. |
| 4 | + * @see http://www.mediawiki.org/wiki/Extension:Live_Translate |
| 5 | + * |
| 6 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 7 | + */ |
| 8 | + |
| 9 | +(function($) { $( document ).ready( function() { |
| 10 | + |
| 11 | + /* |
| 12 | + * jQuery replaceText - v1.1 - 11/21/2009 |
| 13 | + * http://benalman.com/projects/jquery-replacetext-plugin/ |
| 14 | + * |
| 15 | + * Copyright (c) 2009 "Cowboy" Ben Alman |
| 16 | + * Dual licensed under the MIT and GPL licenses. |
| 17 | + * http://benalman.com/about/license/ |
| 18 | + */ |
| 19 | + $.fn.replaceText=function(b,a,c){return this.each(function(){var f=this.firstChild,g,e,d=[];if(f){do{if(f.nodeType===3){g=f.nodeValue;e=g.replace(b,a);if(e!==g){if(!c&&/</.test(e)){$(f).before(e);d.push(f)}else{f.nodeValue=e}}}}while(f=f.nextSibling)}d.length&&$(d).remove()})} |
| 20 | + |
| 21 | + var currentLang = window.sourceLang; |
| 22 | + |
| 23 | + var runningJobs = 0; |
| 24 | + |
| 25 | + // This is to enable a hack to decode quotes. |
| 26 | + var textAreaElement = document.createElement( 'textarea' ); |
| 27 | + |
| 28 | + // For the "show original" feature. |
| 29 | + var originalHtml = false; |
| 30 | + |
| 31 | + // Compatibility with pre-RL code. |
| 32 | + // Messages will have been loaded into wgPushMessages. |
| 33 | + if ( typeof mediaWiki === 'undefined' ) { |
| 34 | + mediaWiki = new Object(); |
| 35 | + |
| 36 | + mediaWiki.msg = function() { |
| 37 | + message = window.wgLTEMessages[arguments[0]]; |
| 38 | + |
| 39 | + for ( var i = arguments.length - 1; i > 0; i-- ) { |
| 40 | + message = message.replace( '$' + i, arguments[i] ); |
| 41 | + } |
| 42 | + |
| 43 | + return message; |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Queries the special words in the source language, finds them in the page, |
| 49 | + * and wraps the into notranslate spans. Then initiates the translation process. |
| 50 | + */ |
| 51 | + setupTranslationFeatures = function() { |
| 52 | + $( this ).attr( "disabled", true ).text( mediaWiki.msg( 'livetranslate-button-translating' ) ); |
| 53 | + |
| 54 | + if ( originalHtml === false ) { |
| 55 | + $.getJSON( |
| 56 | + wgScriptPath + '/api.php', |
| 57 | + { |
| 58 | + 'action': 'query', |
| 59 | + 'format': 'json', |
| 60 | + 'list': 'livetranslate', |
| 61 | + 'ltlanguage': currentLang |
| 62 | + }, |
| 63 | + function( data ) { |
| 64 | + if ( data.words ) { |
| 65 | + insertNoTranslateTags( data.words ); |
| 66 | + } |
| 67 | + else if ( data.error && data.error.info ) { |
| 68 | + alert( data.error.info ); |
| 69 | + } |
| 70 | + else { |
| 71 | + for ( i in data ) { |
| 72 | + alert( mediaWiki.msg( 'livetranslate-dictionary-error' ) ); |
| 73 | + break; |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + originalHtml = $( '#bodyContent' ).html(); |
| 78 | + |
| 79 | + initiateTranslating(); |
| 80 | + } |
| 81 | + ); |
| 82 | + } |
| 83 | + else { |
| 84 | + initiateTranslating(); |
| 85 | + } |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * Initiates the translation process. |
| 90 | + * First all special words are found and send to the local API, |
| 91 | + * and then replaced by their translation in the response. Then |
| 92 | + * the Google Translate translation is initiated. |
| 93 | + */ |
| 94 | + function initiateTranslating() { |
| 95 | + var words = getSpecialWords(); |
| 96 | + var newLang = $( '#livetranslatelang' ).val(); |
| 97 | + |
| 98 | + if ( words.length == 0 ) { |
| 99 | + requestGoogleTranslate( currentLang, newLang ); |
| 100 | + } |
| 101 | + else { |
| 102 | + $.getJSON( |
| 103 | + wgScriptPath + '/api.php', |
| 104 | + { |
| 105 | + 'action': 'livetranslate', |
| 106 | + 'format': 'json', |
| 107 | + 'from': currentLang, |
| 108 | + 'to': newLang, |
| 109 | + 'words': words.join( '|' ) |
| 110 | + }, |
| 111 | + function( data ) { |
| 112 | + if ( data.translations ) { |
| 113 | + replaceSpecialWords( data.translations ); |
| 114 | + } |
| 115 | + requestGoogleTranslate( currentLang, newLang ); |
| 116 | + } |
| 117 | + ); |
| 118 | + } |
| 119 | + } |
| 120 | + |
| 121 | + /** |
| 122 | + * Shows the original page content, simply by setting the html to a stored copy of the original. |
| 123 | + * Also re-binds the jQuery events, as they get lost when doing the html replace. |
| 124 | + */ |
| 125 | + showOriginal = function() { |
| 126 | + currentLang = window.sourceLang; |
| 127 | + $( '#bodyContent' ).html( originalHtml ); |
| 128 | + $( '#livetranslatebutton' ).attr( "disabled", false ).text( mediaWiki.msg( 'livetranslate-button-translate' ) ); |
| 129 | + $( '#livetranslatebutton' ).click( setupTranslationFeatures ); |
| 130 | + $( '#ltrevertbutton' ).click( showOriginal ); |
| 131 | + } |
| 132 | + |
| 133 | + // Initial binding of the button click events. |
| 134 | + $( '#livetranslatebutton' ).click( setupTranslationFeatures ); |
| 135 | + $( '#ltrevertbutton' ).click( showOriginal ); |
| 136 | + |
| 137 | + /** |
| 138 | + * Inserts notranslate spans around the words specified in the passed array in the page content. |
| 139 | + * |
| 140 | + * @param {Array} words |
| 141 | + */ |
| 142 | + function insertNoTranslateTags( words ) { |
| 143 | + for ( i in words ) { |
| 144 | + $( '#bodyContent *' ).replaceText( |
| 145 | + new RegExp( "\\b" + words[i] + "\\b", "g" ), |
| 146 | + function( str ) { |
| 147 | + return '<span class="notranslate">' + str + '</span>' |
| 148 | + } |
| 149 | + ); |
| 150 | + } |
| 151 | + } |
| 152 | + |
| 153 | + /** |
| 154 | + * Finds the special words in the page contents by getting the contents of all |
| 155 | + * notranslate spans and pushing them onto an array. |
| 156 | + * |
| 157 | + * @returns {Array} |
| 158 | + */ |
| 159 | + function getSpecialWords() { |
| 160 | + var words = []; |
| 161 | + |
| 162 | + $.each($( '.notranslate' ), function( i, v ) { |
| 163 | + if ( $(v).attr( 'id' ) != 'livetranslatespan' ) { |
| 164 | + words.push( $(v).text() ); |
| 165 | + } |
| 166 | + }); |
| 167 | + |
| 168 | + return words; |
| 169 | + } |
| 170 | + |
| 171 | + /** |
| 172 | + * Replaced the special words in the page content by looping over them, |
| 173 | + * and checking if there is a matching translation in the provided object. |
| 174 | + * |
| 175 | + * @param {object} translations |
| 176 | + */ |
| 177 | + function replaceSpecialWords( translations ) { |
| 178 | + $.each($(".notranslate"), function(i,v) { |
| 179 | + var currentText = $(v).text(); |
| 180 | + if ( translations[currentText] ) { |
| 181 | + $(v).text( translations[currentText] ); |
| 182 | + } |
| 183 | + }); |
| 184 | + } |
| 185 | + |
| 186 | + /** |
| 187 | + * Initiates the Google Translate translation. |
| 188 | + * |
| 189 | + * @param {string} sourceLang |
| 190 | + * @param {string} targetLang |
| 191 | + */ |
| 192 | + function requestGoogleTranslate( sourceLang, targetLang ) { |
| 193 | + translateElement( $( '#bodyContent' ), sourceLang, targetLang ); |
| 194 | + } |
| 195 | + |
| 196 | + /** |
| 197 | + * Translates a single DOM element using Google Translate. |
| 198 | + * Loops through child elements and recursivly calls itself to translate these. |
| 199 | + * |
| 200 | + * TODO: be smarter with the requests, and make sure they don't get broken up unecesarrily. |
| 201 | + * |
| 202 | + * @param {jQuery} element |
| 203 | + * @param {string} sourceLang |
| 204 | + * @param {string} targetLang |
| 205 | + */ |
| 206 | + function translateElement( element, sourceLang, targetLang ) { |
| 207 | + runningJobs++; |
| 208 | + |
| 209 | + var maxChunkLength = 500; |
| 210 | + |
| 211 | + element.contents().each( function() { |
| 212 | + // If it's a text node, then translate it. |
| 213 | + if ( this.nodeType == 3 && this.data != undefined && jQuery.trim( this.data ).length > 0 ) { |
| 214 | + runningJobs++; |
| 215 | + translateChunk( |
| 216 | + this.data.split( new RegExp( "(\\S.+?[.!?])(?=\\s+|$)", "gi" ) ), |
| 217 | + [], |
| 218 | + maxChunkLength, |
| 219 | + sourceLang, |
| 220 | + targetLang, |
| 221 | + this |
| 222 | + ); |
| 223 | + } |
| 224 | + // If it's an html element, check to see if it should be ignored, and if not, apply function again. |
| 225 | + else if ( $.inArray( $( this ).attr( 'id' ), [ 'livetranslatediv', 'siteSub', 'jump-to-nav' ] ) == -1 |
| 226 | + && !$( this ).hasClass( 'notranslate' ) && !$( this ).hasClass( 'printfooter' ) |
| 227 | + && $( this ).text().length > 0 ) { |
| 228 | + |
| 229 | + translateElement( $( this ), sourceLang, targetLang ); |
| 230 | + } |
| 231 | + } ); |
| 232 | + |
| 233 | + handleTranslationCompletion( targetLang ); |
| 234 | + } |
| 235 | + |
| 236 | + /** |
| 237 | + * Determines a chunk to translate of an DOM elements contents and calls the Google Translate API. |
| 238 | + * Then calls itself if there is any remaining work to be done. |
| 239 | + * |
| 240 | + * @param {array} untranslatedsentences |
| 241 | + * @param {array} chunks |
| 242 | + * @param {integer} currentMaxSize |
| 243 | + * @param {string} sourceLang |
| 244 | + * @param {string} targetLang |
| 245 | + * @param {jQuery} element |
| 246 | + */ |
| 247 | + function translateChunk( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ) { |
| 248 | + var remainingPart = false; |
| 249 | + var partToUse = false; |
| 250 | + var sentenceCount = 0; |
| 251 | + var currentLength = 0; |
| 252 | + |
| 253 | + // Find the scentances that can be put in the current chunk. |
| 254 | + for ( i in untranslatedsentences ) { |
| 255 | + sentenceCount++; |
| 256 | + |
| 257 | + if ( currentLength + untranslatedsentences[i].length < currentMaxSize ) { |
| 258 | + currentLength += untranslatedsentences[i].length; |
| 259 | + } |
| 260 | + else if ( untranslatedsentences[i].length > 0 ) { |
| 261 | + if ( currentLength == 0 ) { |
| 262 | + // If the first scentance is longer then the max chunk legth, split it. |
| 263 | + partToUse = untranslatedsentences[i].substr( 0, currentMaxSize - currentLength ); |
| 264 | + remainingPart = untranslatedsentences[i].substr( currentMaxSize - currentLength ); |
| 265 | + } |
| 266 | + |
| 267 | + break; |
| 268 | + } |
| 269 | + } |
| 270 | + |
| 271 | + var chunk = ''; |
| 272 | + |
| 273 | + // Build the chunck. |
| 274 | + for ( i = 0; i < sentenceCount; i++ ) { |
| 275 | + var part = untranslatedsentences.shift(); |
| 276 | + |
| 277 | + if ( i != sentenceCount - 1 || partToUse === false ) { |
| 278 | + chunk += part; |
| 279 | + } |
| 280 | + } |
| 281 | + |
| 282 | + // If there is a remaining part, re-add it to the scentances to translate list. |
| 283 | + if ( remainingPart !== false ) { |
| 284 | + untranslatedsentences.unshift( remainingPart ); |
| 285 | + } |
| 286 | + |
| 287 | + // If there is a partial scentance, add it to the chunk. |
| 288 | + if ( partToUse !== false ) { |
| 289 | + chunk += partToUse; |
| 290 | + } |
| 291 | + |
| 292 | + // If the lenght is 0, the element has been translated. |
| 293 | + if ( chunk.length == 0 ) { |
| 294 | + handleTranslationCompletion( targetLang ); |
| 295 | + return; |
| 296 | + } |
| 297 | + |
| 298 | + // Keep track of leading and tailing spaces, as they often get modified by the GT API. |
| 299 | + var leadingSpace = chunk.substr( 0, 1 ) == ' ' ? ' ' : ''; |
| 300 | + var tailingSpace = ( chunk.length > 1 && chunk.substr( chunk.length - 1, 1 ) == ' ' ) ? ' ' : ''; |
| 301 | + |
| 302 | + google.language.translate( |
| 303 | + jQuery.trim( chunk ), // Trim, so the result does not contain preceding or tailing spaces. |
| 304 | + sourceLang, |
| 305 | + targetLang, |
| 306 | + function(result) { |
| 307 | + if ( result.translation ) { |
| 308 | + chunks.push( leadingSpace + result.translation + tailingSpace ); |
| 309 | + } |
| 310 | + else { |
| 311 | + // If the translation failed, keep the original text. |
| 312 | + chunks.push( chunk ); |
| 313 | + } |
| 314 | + |
| 315 | + if ( untranslatedsentences.length == 0 ) { |
| 316 | + // If the current chunk was smaller then the max size, node translation is complete, so update text. |
| 317 | + textAreaElement.innerHTML = chunks.join(); // This is a hack to decode quotes. |
| 318 | + element.replaceData( 0, element.length, textAreaElement.value ); |
| 319 | + handleTranslationCompletion( targetLang ); |
| 320 | + } |
| 321 | + else { |
| 322 | + // If there is more work to do, move on to the next chunk. |
| 323 | + translateChunk( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ); |
| 324 | + } |
| 325 | + } |
| 326 | + ); |
| 327 | + } |
| 328 | + |
| 329 | + /** |
| 330 | + * Should be called every time a DOM element has been translated. |
| 331 | + * By use of the runningJobs var, completion of the translation process is detected, |
| 332 | + * and further handled by this function. |
| 333 | + * |
| 334 | + * @param {string} targetLang |
| 335 | + */ |
| 336 | + function handleTranslationCompletion( targetLang ) { |
| 337 | + if ( !--runningJobs ) { |
| 338 | + currentLang = targetLang; |
| 339 | + $( '#livetranslatebutton' ).attr( "disabled", false ).text( mediaWiki.msg( 'livetranslate-button-translate' ) ); |
| 340 | + $( '#ltrevertbutton' ).css( 'display', 'inline' ); |
| 341 | + } |
| 342 | + } |
| 343 | + |
| 344 | +} ); })(jQuery); |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_0_3/includes/ext.livetranslate.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 345 | + native |
Index: tags/extensions/LiveTranslate/REL_0_3/includes/LiveTranslate_Functions.php |
— | — | @@ -0,0 +1,384 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Statis class with utility methods for the Live Translate extension. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file LiveTranslate_Functions.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 13 | + */ |
| 14 | +final class LiveTranslateFunctions { |
| 15 | + |
| 16 | + /** |
| 17 | + * Loads the needed JavaScript. |
| 18 | + * Takes care of non-RL compatibility. |
| 19 | + * |
| 20 | + * @since 0.1 |
| 21 | + */ |
| 22 | + public static function loadJs() { |
| 23 | + global $wgOut; |
| 24 | + |
| 25 | + // For backward compatibility with MW < 1.17. |
| 26 | + if ( is_callable( array( $wgOut, 'addModules' ) ) ) { |
| 27 | + $wgOut->addModules( 'ext.livetranslate' ); |
| 28 | + } |
| 29 | + else { |
| 30 | + global $egLiveTranslateScriptPath; |
| 31 | + |
| 32 | + self::addJSLocalisation(); |
| 33 | + |
| 34 | + $wgOut->includeJQuery(); |
| 35 | + |
| 36 | + $wgOut->addHeadItem( |
| 37 | + 'ext.livetranslate', |
| 38 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.livetranslate.js' ) |
| 39 | + ); |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * Adds the needed JS messages to the page output. |
| 45 | + * This is for backward compatibility with pre-RL MediaWiki. |
| 46 | + * |
| 47 | + * @since 0.1 |
| 48 | + */ |
| 49 | + protected static function addJSLocalisation() { |
| 50 | + global $egLTJSMessages, $wgOut; |
| 51 | + |
| 52 | + $data = array(); |
| 53 | + |
| 54 | + foreach ( $egLTJSMessages as $msg ) { |
| 55 | + $data[$msg] = wfMsgNoTrans( $msg ); |
| 56 | + } |
| 57 | + |
| 58 | + $wgOut->addInlineScript( 'var wgLTEMessages = ' . json_encode( $data ) . ';' ); |
| 59 | + } |
| 60 | + |
| 61 | + /** |
| 62 | + * Returns the language code for a title. |
| 63 | + * |
| 64 | + * @param Title $title |
| 65 | + * |
| 66 | + * @return string |
| 67 | + */ |
| 68 | + public static function getCurrentLang( Title $title ) { |
| 69 | + $subPage = array_pop( explode( '/', $title->getSubpageText() ) ); |
| 70 | + |
| 71 | + if ( $subPage != '' && array_key_exists( $subPage, Language::getLanguageNames( false ) ) ) { |
| 72 | + return $subPage; |
| 73 | + } |
| 74 | + |
| 75 | + global $wgLanguageCode; |
| 76 | + return $wgLanguageCode; |
| 77 | + } |
| 78 | + |
| 79 | + /** |
| 80 | + * Returns the HTML for a language selector. |
| 81 | + * |
| 82 | + * @since 0.1 |
| 83 | + * |
| 84 | + * @param string $currentLang |
| 85 | + * |
| 86 | + * @return string |
| 87 | + */ |
| 88 | + public static function getLanguageSelector( $currentLang ) { |
| 89 | + global $wgUser, $wgLanguageCode, $egLiveTranslateLanguages; |
| 90 | + |
| 91 | + $allowedLanguages = array_merge( $egLiveTranslateLanguages, array( $currentLang ) ); |
| 92 | + |
| 93 | + $targetLang = $wgLanguageCode; |
| 94 | + |
| 95 | + $languages = Language::getLanguageNames( false ); |
| 96 | + |
| 97 | + if ( $wgUser->isLoggedIn() ) { |
| 98 | + $userLang = $wgUser->getOption( 'language' ); |
| 99 | + |
| 100 | + if ( array_key_exists( $userLang, $languages ) && in_array( $userLang, $allowedLanguages ) ) { |
| 101 | + $targetLang = $userLang; |
| 102 | + } |
| 103 | + } |
| 104 | + |
| 105 | + $options = array(); |
| 106 | + ksort( $languages ); |
| 107 | + |
| 108 | + foreach ( $languages as $code => $name ) { |
| 109 | + if ( in_array( $code, $allowedLanguages ) && $code != $currentLang ) { |
| 110 | + $display = wfBCP47( $code ) . ' - ' . $name; |
| 111 | + $options[$display] = $code; |
| 112 | + } |
| 113 | + } |
| 114 | + |
| 115 | + $languageSelector = new HTMLSelectField( array( |
| 116 | + 'id' => 'livetranslatelang', |
| 117 | + 'fieldname' => 'language', |
| 118 | + 'options' => $options |
| 119 | + ) ); |
| 120 | + |
| 121 | + return $languageSelector->getInputHTML( $targetLang ); |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * Gets a list of all available languages. |
| 126 | + * |
| 127 | + * @since 0.1 |
| 128 | + * |
| 129 | + * @return array |
| 130 | + */ |
| 131 | + public static function getAvailableLanguages() { |
| 132 | + $dbr = wfGetDB( DB_SLAVE ); |
| 133 | + |
| 134 | + $destinationLangs = array(); |
| 135 | + |
| 136 | + // TODO: fix index |
| 137 | + $res = $dbr->query( 'SELECT DISTINCT word_language FROM ' . $dbr->tableName( 'live_translate' ) ); |
| 138 | + |
| 139 | + while ( $lang = $dbr->fetchObject( $res ) ) { |
| 140 | + $destinationLangs[] = $lang->word_language; |
| 141 | + } |
| 142 | + |
| 143 | + return $destinationLangs; |
| 144 | + } |
| 145 | + |
| 146 | + /** |
| 147 | + * Gets a list of all special words in a language. |
| 148 | + * |
| 149 | + * @since 0.1 |
| 150 | + * |
| 151 | + * @param string $language |
| 152 | + * |
| 153 | + * @return array |
| 154 | + */ |
| 155 | + public static function getSpecialWordsForLang( $language ) { |
| 156 | + $dbr = wfGetDB( DB_SLAVE ); |
| 157 | + |
| 158 | + $words = array(); |
| 159 | + |
| 160 | + // TODO: fix index |
| 161 | + $res = $dbr->query( |
| 162 | + 'SELECT DISTINCT word_translation FROM ' . |
| 163 | + $dbr->tableName( 'live_translate' ) . |
| 164 | + ' WHERE word_language = ' . $dbr->addQuotes( $language ) |
| 165 | + ); |
| 166 | + |
| 167 | + while ( $translation = $dbr->fetchObject( $res ) ) { |
| 168 | + $words[] = $translation->word_translation; |
| 169 | + } |
| 170 | + |
| 171 | + return $words; |
| 172 | + } |
| 173 | + |
| 174 | + /** |
| 175 | + * Parses the provided dictionary content and returns it as an |
| 176 | + * array of associative arrays. |
| 177 | + * |
| 178 | + * @since 0.1 |
| 179 | + * |
| 180 | + * @param string $content |
| 181 | + * |
| 182 | + * @return array |
| 183 | + */ |
| 184 | + public static function parseTranslations( $content ) { |
| 185 | + $translationSets = array(); |
| 186 | + |
| 187 | + $lines = explode( "\n", $content ); |
| 188 | + $languages = array_map( 'trim', explode( ',', array_shift( $lines ) ) ); |
| 189 | + |
| 190 | + foreach ( $lines as $line ) { |
| 191 | + $values = array_map( 'trim', explode( ',', $line ) ); |
| 192 | + |
| 193 | + $translations = array(); |
| 194 | + |
| 195 | + foreach ( $values as $nr => $value ) { |
| 196 | + if ( array_key_exists( $nr, $languages ) ) { |
| 197 | + // Add the translation (or translations) (value, array) of the word in the language (key). |
| 198 | + $translations[$languages[$nr]] = array_map( 'trim', explode( '|', $value ) ); |
| 199 | + } |
| 200 | + } |
| 201 | + |
| 202 | + $translationSets[] = $translations; |
| 203 | + } |
| 204 | + |
| 205 | + return $translationSets; |
| 206 | + } |
| 207 | + |
| 208 | + /** |
| 209 | + * Replaces the current translations with the provided ones. |
| 210 | + * |
| 211 | + * @since 0.1 |
| 212 | + * |
| 213 | + * @param array $translationSets |
| 214 | + */ |
| 215 | + public static function saveTranslations( array $translationSets ) { |
| 216 | + $dbw = wfGetDB( DB_MASTER ); |
| 217 | + |
| 218 | + $dbw->query( 'TRUNCATE TABLE ' . $dbw->tableName( 'live_translate' ) ); |
| 219 | + |
| 220 | + foreach ( $translationSets as $wordId => $translationSet ) { |
| 221 | + foreach ( $translationSet as $language => $translations ) { |
| 222 | + $primary = 1; |
| 223 | + |
| 224 | + foreach ( $translations as $translation ) { |
| 225 | + $dbw->insert( |
| 226 | + 'live_translate', |
| 227 | + array( |
| 228 | + 'word_id' => $wordId, |
| 229 | + 'word_language' => $language, |
| 230 | + 'word_translation' => $translation, |
| 231 | + 'word_primary' => $primary |
| 232 | + ) |
| 233 | + ); |
| 234 | + |
| 235 | + $primary = 0; |
| 236 | + } |
| 237 | + } |
| 238 | + } |
| 239 | + } |
| 240 | + |
| 241 | + /** |
| 242 | + * Returns a PHP version of the JavaScript google.language.Languages enum of the Google Translate v1 API. |
| 243 | + * @see https://code.google.com/apis/language/translate/v1/getting_started.html#LangNameArray |
| 244 | + * |
| 245 | + * @since 0.1 |
| 246 | + * |
| 247 | + * @return array LANGUAGE_NAME => 'code' |
| 248 | + */ |
| 249 | + public static function getGTSupportedLanguages() { |
| 250 | + return array( |
| 251 | + 'AFRIKAANS' => 'af', |
| 252 | + 'ALBANIAN' => 'sq', |
| 253 | + 'AMHARIC' => 'am', |
| 254 | + 'ARABIC' => 'ar', |
| 255 | + 'ARMENIAN' => 'hy', |
| 256 | + 'AZERBAIJANI' => 'az', |
| 257 | + 'BASQUE' => 'eu', |
| 258 | + 'BELARUSIAN' => 'be', |
| 259 | + 'BENGALI' => 'bn', |
| 260 | + 'BIHARI' => 'bh', |
| 261 | + 'BRETON' => 'br', |
| 262 | + 'BULGARIAN' => 'bg', |
| 263 | + 'BURMESE' => 'my', |
| 264 | + 'CATALAN' => 'ca', |
| 265 | + 'CHEROKEE' => 'chr', |
| 266 | + 'CHINESE' => 'zh', |
| 267 | + 'CHINESE_SIMPLIFIED' => 'zh-CN', |
| 268 | + 'CHINESE_TRADITIONAL' => 'zh-TW', |
| 269 | + 'CORSICAN' => 'co', |
| 270 | + 'CROATIAN' => 'hr', |
| 271 | + 'CZECH' => 'cs', |
| 272 | + 'DANISH' => 'da', |
| 273 | + 'DHIVEHI' => 'dv', |
| 274 | + 'DUTCH'=> 'nl', |
| 275 | + 'ENGLISH' => 'en', |
| 276 | + 'ESPERANTO' => 'eo', |
| 277 | + 'ESTONIAN' => 'et', |
| 278 | + 'FAROESE' => 'fo', |
| 279 | + 'FILIPINO' => 'tl', |
| 280 | + 'FINNISH' => 'fi', |
| 281 | + 'FRENCH' => 'fr', |
| 282 | + 'FRISIAN' => 'fy', |
| 283 | + 'GALICIAN' => 'gl', |
| 284 | + 'GEORGIAN' => 'ka', |
| 285 | + 'GERMAN' => 'de', |
| 286 | + 'GREEK' => 'el', |
| 287 | + 'GUJARATI' => 'gu', |
| 288 | + 'HAITIAN_CREOLE' => 'ht', |
| 289 | + 'HEBREW' => 'iw', |
| 290 | + 'HINDI' => 'hi', |
| 291 | + 'HUNGARIAN' => 'hu', |
| 292 | + 'ICELANDIC' => 'is', |
| 293 | + 'INDONESIAN' => 'id', |
| 294 | + 'INUKTITUT' => 'iu', |
| 295 | + 'IRISH' => 'ga', |
| 296 | + 'ITALIAN' => 'it', |
| 297 | + 'JAPANESE' => 'ja', |
| 298 | + 'JAVANESE' => 'jw', |
| 299 | + 'KANNADA' => 'kn', |
| 300 | + 'KAZAKH' => 'kk', |
| 301 | + 'KHMER' => 'km', |
| 302 | + 'KOREAN' => 'ko', |
| 303 | + 'KURDISH'=> 'ku', |
| 304 | + 'KYRGYZ'=> 'ky', |
| 305 | + 'LAO' => 'lo', |
| 306 | + 'LATIN' => 'la', |
| 307 | + 'LATVIAN' => 'lv', |
| 308 | + 'LITHUANIAN' => 'lt', |
| 309 | + 'LUXEMBOURGISH' => 'lb', |
| 310 | + 'MACEDONIAN' => 'mk', |
| 311 | + 'MALAY' => 'ms', |
| 312 | + 'MALAYALAM' => 'ml', |
| 313 | + 'MALTESE' => 'mt', |
| 314 | + 'MAORI' => 'mi', |
| 315 | + 'MARATHI' => 'mr', |
| 316 | + 'MONGOLIAN' => 'mn', |
| 317 | + 'NEPALI' => 'ne', |
| 318 | + 'NORWEGIAN' => 'no', |
| 319 | + 'OCCITAN' => 'oc', |
| 320 | + 'ORIYA' => 'or', |
| 321 | + 'PASHTO' => 'ps', |
| 322 | + 'PERSIAN' => 'fa', |
| 323 | + 'POLISH' => 'pl', |
| 324 | + 'PORTUGUESE' => 'pt', |
| 325 | + 'PORTUGUESE_PORTUGAL' => 'pt-PT', |
| 326 | + 'PUNJABI' => 'pa', |
| 327 | + 'QUECHUA' => 'qu', |
| 328 | + 'ROMANIAN' => 'ro', |
| 329 | + 'RUSSIAN' => 'ru', |
| 330 | + 'SANSKRIT' => 'sa', |
| 331 | + 'SCOTS_GAELIC' => 'gd', |
| 332 | + 'SERBIAN' => 'sr', |
| 333 | + 'SINDHI' => 'sd', |
| 334 | + 'SINHALESE' => 'si', |
| 335 | + 'SLOVAK' => 'sk', |
| 336 | + 'SLOVENIAN' => 'sl', |
| 337 | + 'SPANISH' => 'es', |
| 338 | + 'SUNDANESE' => 'su', |
| 339 | + 'SWAHILI' => 'sw', |
| 340 | + 'SWEDISH' => 'sv', |
| 341 | + 'SYRIAC' => 'syr', |
| 342 | + 'TAJIK' => 'tg', |
| 343 | + 'TAMIL' => 'ta', |
| 344 | + 'TATAR' => 'tt', |
| 345 | + 'TELUGU' => 'te', |
| 346 | + 'THAI' => 'th', |
| 347 | + 'TIBETAN' => 'bo', |
| 348 | + 'TONGA' => 'to', |
| 349 | + 'TURKISH' => 'tr', |
| 350 | + 'UKRAINIAN' => 'uk', |
| 351 | + 'URDU' => 'ur', |
| 352 | + 'UZBEK' => 'uz', |
| 353 | + 'UIGHUR' => 'ug', |
| 354 | + 'VIETNAMESE' => 'vi', |
| 355 | + 'WELSH' => 'cy', |
| 356 | + 'YIDDISH' => 'yi', |
| 357 | + 'YORUBA' => 'yo', |
| 358 | + ); |
| 359 | + } |
| 360 | + |
| 361 | + /** |
| 362 | + * Returns the provided text starting with a letter in toggeled case. |
| 363 | + * If there is no difference between lowercase and upercase for the first |
| 364 | + * character, false is returned. |
| 365 | + * |
| 366 | + * @since 0.1 |
| 367 | + * |
| 368 | + * @param string $text |
| 369 | + * |
| 370 | + * @return mixed |
| 371 | + */ |
| 372 | + public static function getToggledCase( $text ) { |
| 373 | + $isUpper = Language::firstChar( $text) == strtoupper( Language::firstChar( $text) ); |
| 374 | + $isLower = Language::firstChar( $text) == strtolower( Language::firstChar( $text) ); |
| 375 | + |
| 376 | + if ( $isUpper XOR $isLower ) { |
| 377 | + $text = $isUpper ? Language::lcfirst( $text ) : Language::ucfirst( $text ); |
| 378 | + return $text; |
| 379 | + } |
| 380 | + else { |
| 381 | + return false; |
| 382 | + } |
| 383 | + } |
| 384 | + |
| 385 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_0_3/includes/LiveTranslate_Functions.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 386 | + native |
Index: tags/extensions/LiveTranslate/REL_0_3/COPYING |
— | — | @@ -0,0 +1,682 @@ |
| 2 | +The license text below "----" applies to all files within this distribution, other |
| 3 | +than those that are in a directory which contains files named "LICENSE" or |
| 4 | +"COPYING", or a subdirectory thereof. For those files, the license text contained in |
| 5 | +said file overrides any license information contained in directories of smaller depth. |
| 6 | +Alternative licenses are typically used for software that is provided by external |
| 7 | +parties, and merely packaged with this software for convenience. |
| 8 | +---- |
| 9 | + |
| 10 | + GNU GENERAL PUBLIC LICENSE |
| 11 | + Version 3, 29 June 2007 |
| 12 | + |
| 13 | + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> |
| 14 | + Everyone is permitted to copy and distribute verbatim copies |
| 15 | + of this license document, but changing it is not allowed. |
| 16 | + |
| 17 | + Preamble |
| 18 | + |
| 19 | + The GNU General Public License is a free, copyleft license for |
| 20 | +software and other kinds of works. |
| 21 | + |
| 22 | + The licenses for most software and other practical works are designed |
| 23 | +to take away your freedom to share and change the works. By contrast, |
| 24 | +the GNU General Public License is intended to guarantee your freedom to |
| 25 | +share and change all versions of a program--to make sure it remains free |
| 26 | +software for all its users. We, the Free Software Foundation, use the |
| 27 | +GNU General Public License for most of our software; it applies also to |
| 28 | +any other work released this way by its authors. You can apply it to |
| 29 | +your programs, too. |
| 30 | + |
| 31 | + When we speak of free software, we are referring to freedom, not |
| 32 | +price. Our General Public Licenses are designed to make sure that you |
| 33 | +have the freedom to distribute copies of free software (and charge for |
| 34 | +them if you wish), that you receive source code or can get it if you |
| 35 | +want it, that you can change the software or use pieces of it in new |
| 36 | +free programs, and that you know you can do these things. |
| 37 | + |
| 38 | + To protect your rights, we need to prevent others from denying you |
| 39 | +these rights or asking you to surrender the rights. Therefore, you have |
| 40 | +certain responsibilities if you distribute copies of the software, or if |
| 41 | +you modify it: responsibilities to respect the freedom of others. |
| 42 | + |
| 43 | + For example, if you distribute copies of such a program, whether |
| 44 | +gratis or for a fee, you must pass on to the recipients the same |
| 45 | +freedoms that you received. You must make sure that they, too, receive |
| 46 | +or can get the source code. And you must show them these terms so they |
| 47 | +know their rights. |
| 48 | + |
| 49 | + Developers that use the GNU GPL protect your rights with two steps: |
| 50 | +(1) assert copyright on the software, and (2) offer you this License |
| 51 | +giving you legal permission to copy, distribute and/or modify it. |
| 52 | + |
| 53 | + For the developers' and authors' protection, the GPL clearly explains |
| 54 | +that there is no warranty for this free software. For both users' and |
| 55 | +authors' sake, the GPL requires that modified versions be marked as |
| 56 | +changed, so that their problems will not be attributed erroneously to |
| 57 | +authors of previous versions. |
| 58 | + |
| 59 | + Some devices are designed to deny users access to install or run |
| 60 | +modified versions of the software inside them, although the manufacturer |
| 61 | +can do so. This is fundamentally incompatible with the aim of |
| 62 | +protecting users' freedom to change the software. The systematic |
| 63 | +pattern of such abuse occurs in the area of products for individuals to |
| 64 | +use, which is precisely where it is most unacceptable. Therefore, we |
| 65 | +have designed this version of the GPL to prohibit the practice for those |
| 66 | +products. If such problems arise substantially in other domains, we |
| 67 | +stand ready to extend this provision to those domains in future versions |
| 68 | +of the GPL, as needed to protect the freedom of users. |
| 69 | + |
| 70 | + Finally, every program is threatened constantly by software patents. |
| 71 | +States should not allow patents to restrict development and use of |
| 72 | +software on general-purpose computers, but in those that do, we wish to |
| 73 | +avoid the special danger that patents applied to a free program could |
| 74 | +make it effectively proprietary. To prevent this, the GPL assures that |
| 75 | +patents cannot be used to render the program non-free. |
| 76 | + |
| 77 | + The precise terms and conditions for copying, distribution and |
| 78 | +modification follow. |
| 79 | + |
| 80 | + TERMS AND CONDITIONS |
| 81 | + |
| 82 | + 0. Definitions. |
| 83 | + |
| 84 | + "This License" refers to version 3 of the GNU General Public License. |
| 85 | + |
| 86 | + "Copyright" also means copyright-like laws that apply to other kinds of |
| 87 | +works, such as semiconductor masks. |
| 88 | + |
| 89 | + "The Program" refers to any copyrightable work licensed under this |
| 90 | +License. Each licensee is addressed as "you". "Licensees" and |
| 91 | +"recipients" may be individuals or organizations. |
| 92 | + |
| 93 | + To "modify" a work means to copy from or adapt all or part of the work |
| 94 | +in a fashion requiring copyright permission, other than the making of an |
| 95 | +exact copy. The resulting work is called a "modified version" of the |
| 96 | +earlier work or a work "based on" the earlier work. |
| 97 | + |
| 98 | + A "covered work" means either the unmodified Program or a work based |
| 99 | +on the Program. |
| 100 | + |
| 101 | + To "propagate" a work means to do anything with it that, without |
| 102 | +permission, would make you directly or secondarily liable for |
| 103 | +infringement under applicable copyright law, except executing it on a |
| 104 | +computer or modifying a private copy. Propagation includes copying, |
| 105 | +distribution (with or without modification), making available to the |
| 106 | +public, and in some countries other activities as well. |
| 107 | + |
| 108 | + To "convey" a work means any kind of propagation that enables other |
| 109 | +parties to make or receive copies. Mere interaction with a user through |
| 110 | +a computer network, with no transfer of a copy, is not conveying. |
| 111 | + |
| 112 | + An interactive user interface displays "Appropriate Legal Notices" |
| 113 | +to the extent that it includes a convenient and prominently visible |
| 114 | +feature that (1) displays an appropriate copyright notice, and (2) |
| 115 | +tells the user that there is no warranty for the work (except to the |
| 116 | +extent that warranties are provided), that licensees may convey the |
| 117 | +work under this License, and how to view a copy of this License. If |
| 118 | +the interface presents a list of user commands or options, such as a |
| 119 | +menu, a prominent item in the list meets this criterion. |
| 120 | + |
| 121 | + 1. Source Code. |
| 122 | + |
| 123 | + The "source code" for a work means the preferred form of the work |
| 124 | +for making modifications to it. "Object code" means any non-source |
| 125 | +form of a work. |
| 126 | + |
| 127 | + A "Standard Interface" means an interface that either is an official |
| 128 | +standard defined by a recognized standards body, or, in the case of |
| 129 | +interfaces specified for a particular programming language, one that |
| 130 | +is widely used among developers working in that language. |
| 131 | + |
| 132 | + The "System Libraries" of an executable work include anything, other |
| 133 | +than the work as a whole, that (a) is included in the normal form of |
| 134 | +packaging a Major Component, but which is not part of that Major |
| 135 | +Component, and (b) serves only to enable use of the work with that |
| 136 | +Major Component, or to implement a Standard Interface for which an |
| 137 | +implementation is available to the public in source code form. A |
| 138 | +"Major Component", in this context, means a major essential component |
| 139 | +(kernel, window system, and so on) of the specific operating system |
| 140 | +(if any) on which the executable work runs, or a compiler used to |
| 141 | +produce the work, or an object code interpreter used to run it. |
| 142 | + |
| 143 | + The "Corresponding Source" for a work in object code form means all |
| 144 | +the source code needed to generate, install, and (for an executable |
| 145 | +work) run the object code and to modify the work, including scripts to |
| 146 | +control those activities. However, it does not include the work's |
| 147 | +System Libraries, or general-purpose tools or generally available free |
| 148 | +programs which are used unmodified in performing those activities but |
| 149 | +which are not part of the work. For example, Corresponding Source |
| 150 | +includes interface definition files associated with source files for |
| 151 | +the work, and the source code for shared libraries and dynamically |
| 152 | +linked subprograms that the work is specifically designed to require, |
| 153 | +such as by intimate data communication or control flow between those |
| 154 | +subprograms and other parts of the work. |
| 155 | + |
| 156 | + The Corresponding Source need not include anything that users |
| 157 | +can regenerate automatically from other parts of the Corresponding |
| 158 | +Source. |
| 159 | + |
| 160 | + The Corresponding Source for a work in source code form is that |
| 161 | +same work. |
| 162 | + |
| 163 | + 2. Basic Permissions. |
| 164 | + |
| 165 | + All rights granted under this License are granted for the term of |
| 166 | +copyright on the Program, and are irrevocable provided the stated |
| 167 | +conditions are met. This License explicitly affirms your unlimited |
| 168 | +permission to run the unmodified Program. The output from running a |
| 169 | +covered work is covered by this License only if the output, given its |
| 170 | +content, constitutes a covered work. This License acknowledges your |
| 171 | +rights of fair use or other equivalent, as provided by copyright law. |
| 172 | + |
| 173 | + You may make, run and propagate covered works that you do not |
| 174 | +convey, without conditions so long as your license otherwise remains |
| 175 | +in force. You may convey covered works to others for the sole purpose |
| 176 | +of having them make modifications exclusively for you, or provide you |
| 177 | +with facilities for running those works, provided that you comply with |
| 178 | +the terms of this License in conveying all material for which you do |
| 179 | +not control copyright. Those thus making or running the covered works |
| 180 | +for you must do so exclusively on your behalf, under your direction |
| 181 | +and control, on terms that prohibit them from making any copies of |
| 182 | +your copyrighted material outside their relationship with you. |
| 183 | + |
| 184 | + Conveying under any other circumstances is permitted solely under |
| 185 | +the conditions stated below. Sublicensing is not allowed; section 10 |
| 186 | +makes it unnecessary. |
| 187 | + |
| 188 | + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
| 189 | + |
| 190 | + No covered work shall be deemed part of an effective technological |
| 191 | +measure under any applicable law fulfilling obligations under article |
| 192 | +11 of the WIPO copyright treaty adopted on 20 December 1996, or |
| 193 | +similar laws prohibiting or restricting circumvention of such |
| 194 | +measures. |
| 195 | + |
| 196 | + When you convey a covered work, you waive any legal power to forbid |
| 197 | +circumvention of technological measures to the extent such circumvention |
| 198 | +is effected by exercising rights under this License with respect to |
| 199 | +the covered work, and you disclaim any intention to limit operation or |
| 200 | +modification of the work as a means of enforcing, against the work's |
| 201 | +users, your or third parties' legal rights to forbid circumvention of |
| 202 | +technological measures. |
| 203 | + |
| 204 | + 4. Conveying Verbatim Copies. |
| 205 | + |
| 206 | + You may convey verbatim copies of the Program's source code as you |
| 207 | +receive it, in any medium, provided that you conspicuously and |
| 208 | +appropriately publish on each copy an appropriate copyright notice; |
| 209 | +keep intact all notices stating that this License and any |
| 210 | +non-permissive terms added in accord with section 7 apply to the code; |
| 211 | +keep intact all notices of the absence of any warranty; and give all |
| 212 | +recipients a copy of this License along with the Program. |
| 213 | + |
| 214 | + You may charge any price or no price for each copy that you convey, |
| 215 | +and you may offer support or warranty protection for a fee. |
| 216 | + |
| 217 | + 5. Conveying Modified Source Versions. |
| 218 | + |
| 219 | + You may convey a work based on the Program, or the modifications to |
| 220 | +produce it from the Program, in the form of source code under the |
| 221 | +terms of section 4, provided that you also meet all of these conditions: |
| 222 | + |
| 223 | + a) The work must carry prominent notices stating that you modified |
| 224 | + it, and giving a relevant date. |
| 225 | + |
| 226 | + b) The work must carry prominent notices stating that it is |
| 227 | + released under this License and any conditions added under section |
| 228 | + 7. This requirement modifies the requirement in section 4 to |
| 229 | + "keep intact all notices". |
| 230 | + |
| 231 | + c) You must license the entire work, as a whole, under this |
| 232 | + License to anyone who comes into possession of a copy. This |
| 233 | + License will therefore apply, along with any applicable section 7 |
| 234 | + additional terms, to the whole of the work, and all its parts, |
| 235 | + regardless of how they are packaged. This License gives no |
| 236 | + permission to license the work in any other way, but it does not |
| 237 | + invalidate such permission if you have separately received it. |
| 238 | + |
| 239 | + d) If the work has interactive user interfaces, each must display |
| 240 | + Appropriate Legal Notices; however, if the Program has interactive |
| 241 | + interfaces that do not display Appropriate Legal Notices, your |
| 242 | + work need not make them do so. |
| 243 | + |
| 244 | + A compilation of a covered work with other separate and independent |
| 245 | +works, which are not by their nature extensions of the covered work, |
| 246 | +and which are not combined with it such as to form a larger program, |
| 247 | +in or on a volume of a storage or distribution medium, is called an |
| 248 | +"aggregate" if the compilation and its resulting copyright are not |
| 249 | +used to limit the access or legal rights of the compilation's users |
| 250 | +beyond what the individual works permit. Inclusion of a covered work |
| 251 | +in an aggregate does not cause this License to apply to the other |
| 252 | +parts of the aggregate. |
| 253 | + |
| 254 | + 6. Conveying Non-Source Forms. |
| 255 | + |
| 256 | + You may convey a covered work in object code form under the terms |
| 257 | +of sections 4 and 5, provided that you also convey the |
| 258 | +machine-readable Corresponding Source under the terms of this License, |
| 259 | +in one of these ways: |
| 260 | + |
| 261 | + a) Convey the object code in, or embodied in, a physical product |
| 262 | + (including a physical distribution medium), accompanied by the |
| 263 | + Corresponding Source fixed on a durable physical medium |
| 264 | + customarily used for software interchange. |
| 265 | + |
| 266 | + b) Convey the object code in, or embodied in, a physical product |
| 267 | + (including a physical distribution medium), accompanied by a |
| 268 | + written offer, valid for at least three years and valid for as |
| 269 | + long as you offer spare parts or customer support for that product |
| 270 | + model, to give anyone who possesses the object code either (1) a |
| 271 | + copy of the Corresponding Source for all the software in the |
| 272 | + product that is covered by this License, on a durable physical |
| 273 | + medium customarily used for software interchange, for a price no |
| 274 | + more than your reasonable cost of physically performing this |
| 275 | + conveying of source, or (2) access to copy the |
| 276 | + Corresponding Source from a network server at no charge. |
| 277 | + |
| 278 | + c) Convey individual copies of the object code with a copy of the |
| 279 | + written offer to provide the Corresponding Source. This |
| 280 | + alternative is allowed only occasionally and noncommercially, and |
| 281 | + only if you received the object code with such an offer, in accord |
| 282 | + with subsection 6b. |
| 283 | + |
| 284 | + d) Convey the object code by offering access from a designated |
| 285 | + place (gratis or for a charge), and offer equivalent access to the |
| 286 | + Corresponding Source in the same way through the same place at no |
| 287 | + further charge. You need not require recipients to copy the |
| 288 | + Corresponding Source along with the object code. If the place to |
| 289 | + copy the object code is a network server, the Corresponding Source |
| 290 | + may be on a different server (operated by you or a third party) |
| 291 | + that supports equivalent copying facilities, provided you maintain |
| 292 | + clear directions next to the object code saying where to find the |
| 293 | + Corresponding Source. Regardless of what server hosts the |
| 294 | + Corresponding Source, you remain obligated to ensure that it is |
| 295 | + available for as long as needed to satisfy these requirements. |
| 296 | + |
| 297 | + e) Convey the object code using peer-to-peer transmission, provided |
| 298 | + you inform other peers where the object code and Corresponding |
| 299 | + Source of the work are being offered to the general public at no |
| 300 | + charge under subsection 6d. |
| 301 | + |
| 302 | + A separable portion of the object code, whose source code is excluded |
| 303 | +from the Corresponding Source as a System Library, need not be |
| 304 | +included in conveying the object code work. |
| 305 | + |
| 306 | + A "User Product" is either (1) a "consumer product", which means any |
| 307 | +tangible personal property which is normally used for personal, family, |
| 308 | +or household purposes, or (2) anything designed or sold for incorporation |
| 309 | +into a dwelling. In determining whether a product is a consumer product, |
| 310 | +doubtful cases shall be resolved in favor of coverage. For a particular |
| 311 | +product received by a particular user, "normally used" refers to a |
| 312 | +typical or common use of that class of product, regardless of the status |
| 313 | +of the particular user or of the way in which the particular user |
| 314 | +actually uses, or expects or is expected to use, the product. A product |
| 315 | +is a consumer product regardless of whether the product has substantial |
| 316 | +commercial, industrial or non-consumer uses, unless such uses represent |
| 317 | +the only significant mode of use of the product. |
| 318 | + |
| 319 | + "Installation Information" for a User Product means any methods, |
| 320 | +procedures, authorization keys, or other information required to install |
| 321 | +and execute modified versions of a covered work in that User Product from |
| 322 | +a modified version of its Corresponding Source. The information must |
| 323 | +suffice to ensure that the continued functioning of the modified object |
| 324 | +code is in no case prevented or interfered with solely because |
| 325 | +modification has been made. |
| 326 | + |
| 327 | + If you convey an object code work under this section in, or with, or |
| 328 | +specifically for use in, a User Product, and the conveying occurs as |
| 329 | +part of a transaction in which the right of possession and use of the |
| 330 | +User Product is transferred to the recipient in perpetuity or for a |
| 331 | +fixed term (regardless of how the transaction is characterized), the |
| 332 | +Corresponding Source conveyed under this section must be accompanied |
| 333 | +by the Installation Information. But this requirement does not apply |
| 334 | +if neither you nor any third party retains the ability to install |
| 335 | +modified object code on the User Product (for example, the work has |
| 336 | +been installed in ROM). |
| 337 | + |
| 338 | + The requirement to provide Installation Information does not include a |
| 339 | +requirement to continue to provide support service, warranty, or updates |
| 340 | +for a work that has been modified or installed by the recipient, or for |
| 341 | +the User Product in which it has been modified or installed. Access to a |
| 342 | +network may be denied when the modification itself materially and |
| 343 | +adversely affects the operation of the network or violates the rules and |
| 344 | +protocols for communication across the network. |
| 345 | + |
| 346 | + Corresponding Source conveyed, and Installation Information provided, |
| 347 | +in accord with this section must be in a format that is publicly |
| 348 | +documented (and with an implementation available to the public in |
| 349 | +source code form), and must require no special password or key for |
| 350 | +unpacking, reading or copying. |
| 351 | + |
| 352 | + 7. Additional Terms. |
| 353 | + |
| 354 | + "Additional permissions" are terms that supplement the terms of this |
| 355 | +License by making exceptions from one or more of its conditions. |
| 356 | +Additional permissions that are applicable to the entire Program shall |
| 357 | +be treated as though they were included in this License, to the extent |
| 358 | +that they are valid under applicable law. If additional permissions |
| 359 | +apply only to part of the Program, that part may be used separately |
| 360 | +under those permissions, but the entire Program remains governed by |
| 361 | +this License without regard to the additional permissions. |
| 362 | + |
| 363 | + When you convey a copy of a covered work, you may at your option |
| 364 | +remove any additional permissions from that copy, or from any part of |
| 365 | +it. (Additional permissions may be written to require their own |
| 366 | +removal in certain cases when you modify the work.) You may place |
| 367 | +additional permissions on material, added by you to a covered work, |
| 368 | +for which you have or can give appropriate copyright permission. |
| 369 | + |
| 370 | + Notwithstanding any other provision of this License, for material you |
| 371 | +add to a covered work, you may (if authorized by the copyright holders of |
| 372 | +that material) supplement the terms of this License with terms: |
| 373 | + |
| 374 | + a) Disclaiming warranty or limiting liability differently from the |
| 375 | + terms of sections 15 and 16 of this License; or |
| 376 | + |
| 377 | + b) Requiring preservation of specified reasonable legal notices or |
| 378 | + author attributions in that material or in the Appropriate Legal |
| 379 | + Notices displayed by works containing it; or |
| 380 | + |
| 381 | + c) Prohibiting misrepresentation of the origin of that material, or |
| 382 | + requiring that modified versions of such material be marked in |
| 383 | + reasonable ways as different from the original version; or |
| 384 | + |
| 385 | + d) Limiting the use for publicity purposes of names of licensors or |
| 386 | + authors of the material; or |
| 387 | + |
| 388 | + e) Declining to grant rights under trademark law for use of some |
| 389 | + trade names, trademarks, or service marks; or |
| 390 | + |
| 391 | + f) Requiring indemnification of licensors and authors of that |
| 392 | + material by anyone who conveys the material (or modified versions of |
| 393 | + it) with contractual assumptions of liability to the recipient, for |
| 394 | + any liability that these contractual assumptions directly impose on |
| 395 | + those licensors and authors. |
| 396 | + |
| 397 | + All other non-permissive additional terms are considered "further |
| 398 | +restrictions" within the meaning of section 10. If the Program as you |
| 399 | +received it, or any part of it, contains a notice stating that it is |
| 400 | +governed by this License along with a term that is a further |
| 401 | +restriction, you may remove that term. If a license document contains |
| 402 | +a further restriction but permits relicensing or conveying under this |
| 403 | +License, you may add to a covered work material governed by the terms |
| 404 | +of that license document, provided that the further restriction does |
| 405 | +not survive such relicensing or conveying. |
| 406 | + |
| 407 | + If you add terms to a covered work in accord with this section, you |
| 408 | +must place, in the relevant source files, a statement of the |
| 409 | +additional terms that apply to those files, or a notice indicating |
| 410 | +where to find the applicable terms. |
| 411 | + |
| 412 | + Additional terms, permissive or non-permissive, may be stated in the |
| 413 | +form of a separately written license, or stated as exceptions; |
| 414 | +the above requirements apply either way. |
| 415 | + |
| 416 | + 8. Termination. |
| 417 | + |
| 418 | + You may not propagate or modify a covered work except as expressly |
| 419 | +provided under this License. Any attempt otherwise to propagate or |
| 420 | +modify it is void, and will automatically terminate your rights under |
| 421 | +this License (including any patent licenses granted under the third |
| 422 | +paragraph of section 11). |
| 423 | + |
| 424 | + However, if you cease all violation of this License, then your |
| 425 | +license from a particular copyright holder is reinstated (a) |
| 426 | +provisionally, unless and until the copyright holder explicitly and |
| 427 | +finally terminates your license, and (b) permanently, if the copyright |
| 428 | +holder fails to notify you of the violation by some reasonable means |
| 429 | +prior to 60 days after the cessation. |
| 430 | + |
| 431 | + Moreover, your license from a particular copyright holder is |
| 432 | +reinstated permanently if the copyright holder notifies you of the |
| 433 | +violation by some reasonable means, this is the first time you have |
| 434 | +received notice of violation of this License (for any work) from that |
| 435 | +copyright holder, and you cure the violation prior to 30 days after |
| 436 | +your receipt of the notice. |
| 437 | + |
| 438 | + Termination of your rights under this section does not terminate the |
| 439 | +licenses of parties who have received copies or rights from you under |
| 440 | +this License. If your rights have been terminated and not permanently |
| 441 | +reinstated, you do not qualify to receive new licenses for the same |
| 442 | +material under section 10. |
| 443 | + |
| 444 | + 9. Acceptance Not Required for Having Copies. |
| 445 | + |
| 446 | + You are not required to accept this License in order to receive or |
| 447 | +run a copy of the Program. Ancillary propagation of a covered work |
| 448 | +occurring solely as a consequence of using peer-to-peer transmission |
| 449 | +to receive a copy likewise does not require acceptance. However, |
| 450 | +nothing other than this License grants you permission to propagate or |
| 451 | +modify any covered work. These actions infringe copyright if you do |
| 452 | +not accept this License. Therefore, by modifying or propagating a |
| 453 | +covered work, you indicate your acceptance of this License to do so. |
| 454 | + |
| 455 | + 10. Automatic Licensing of Downstream Recipients. |
| 456 | + |
| 457 | + Each time you convey a covered work, the recipient automatically |
| 458 | +receives a license from the original licensors, to run, modify and |
| 459 | +propagate that work, subject to this License. You are not responsible |
| 460 | +for enforcing compliance by third parties with this License. |
| 461 | + |
| 462 | + An "entity transaction" is a transaction transferring control of an |
| 463 | +organization, or substantially all assets of one, or subdividing an |
| 464 | +organization, or merging organizations. If propagation of a covered |
| 465 | +work results from an entity transaction, each party to that |
| 466 | +transaction who receives a copy of the work also receives whatever |
| 467 | +licenses to the work the party's predecessor in interest had or could |
| 468 | +give under the previous paragraph, plus a right to possession of the |
| 469 | +Corresponding Source of the work from the predecessor in interest, if |
| 470 | +the predecessor has it or can get it with reasonable efforts. |
| 471 | + |
| 472 | + You may not impose any further restrictions on the exercise of the |
| 473 | +rights granted or affirmed under this License. For example, you may |
| 474 | +not impose a license fee, royalty, or other charge for exercise of |
| 475 | +rights granted under this License, and you may not initiate litigation |
| 476 | +(including a cross-claim or counterclaim in a lawsuit) alleging that |
| 477 | +any patent claim is infringed by making, using, selling, offering for |
| 478 | +sale, or importing the Program or any portion of it. |
| 479 | + |
| 480 | + 11. Patents. |
| 481 | + |
| 482 | + A "contributor" is a copyright holder who authorizes use under this |
| 483 | +License of the Program or a work on which the Program is based. The |
| 484 | +work thus licensed is called the contributor's "contributor version". |
| 485 | + |
| 486 | + A contributor's "essential patent claims" are all patent claims |
| 487 | +owned or controlled by the contributor, whether already acquired or |
| 488 | +hereafter acquired, that would be infringed by some manner, permitted |
| 489 | +by this License, of making, using, or selling its contributor version, |
| 490 | +but do not include claims that would be infringed only as a |
| 491 | +consequence of further modification of the contributor version. For |
| 492 | +purposes of this definition, "control" includes the right to grant |
| 493 | +patent sublicenses in a manner consistent with the requirements of |
| 494 | +this License. |
| 495 | + |
| 496 | + Each contributor grants you a non-exclusive, worldwide, royalty-free |
| 497 | +patent license under the contributor's essential patent claims, to |
| 498 | +make, use, sell, offer for sale, import and otherwise run, modify and |
| 499 | +propagate the contents of its contributor version. |
| 500 | + |
| 501 | + In the following three paragraphs, a "patent license" is any express |
| 502 | +agreement or commitment, however denominated, not to enforce a patent |
| 503 | +(such as an express permission to practice a patent or covenant not to |
| 504 | +sue for patent infringement). To "grant" such a patent license to a |
| 505 | +party means to make such an agreement or commitment not to enforce a |
| 506 | +patent against the party. |
| 507 | + |
| 508 | + If you convey a covered work, knowingly relying on a patent license, |
| 509 | +and the Corresponding Source of the work is not available for anyone |
| 510 | +to copy, free of charge and under the terms of this License, through a |
| 511 | +publicly available network server or other readily accessible means, |
| 512 | +then you must either (1) cause the Corresponding Source to be so |
| 513 | +available, or (2) arrange to deprive yourself of the benefit of the |
| 514 | +patent license for this particular work, or (3) arrange, in a manner |
| 515 | +consistent with the requirements of this License, to extend the patent |
| 516 | +license to downstream recipients. "Knowingly relying" means you have |
| 517 | +actual knowledge that, but for the patent license, your conveying the |
| 518 | +covered work in a country, or your recipient's use of the covered work |
| 519 | +in a country, would infringe one or more identifiable patents in that |
| 520 | +country that you have reason to believe are valid. |
| 521 | + |
| 522 | + If, pursuant to or in connection with a single transaction or |
| 523 | +arrangement, you convey, or propagate by procuring conveyance of, a |
| 524 | +covered work, and grant a patent license to some of the parties |
| 525 | +receiving the covered work authorizing them to use, propagate, modify |
| 526 | +or convey a specific copy of the covered work, then the patent license |
| 527 | +you grant is automatically extended to all recipients of the covered |
| 528 | +work and works based on it. |
| 529 | + |
| 530 | + A patent license is "discriminatory" if it does not include within |
| 531 | +the scope of its coverage, prohibits the exercise of, or is |
| 532 | +conditioned on the non-exercise of one or more of the rights that are |
| 533 | +specifically granted under this License. You may not convey a covered |
| 534 | +work if you are a party to an arrangement with a third party that is |
| 535 | +in the business of distributing software, under which you make payment |
| 536 | +to the third party based on the extent of your activity of conveying |
| 537 | +the work, and under which the third party grants, to any of the |
| 538 | +parties who would receive the covered work from you, a discriminatory |
| 539 | +patent license (a) in connection with copies of the covered work |
| 540 | +conveyed by you (or copies made from those copies), or (b) primarily |
| 541 | +for and in connection with specific products or compilations that |
| 542 | +contain the covered work, unless you entered into that arrangement, |
| 543 | +or that patent license was granted, prior to 28 March 2007. |
| 544 | + |
| 545 | + Nothing in this License shall be construed as excluding or limiting |
| 546 | +any implied license or other defenses to infringement that may |
| 547 | +otherwise be available to you under applicable patent law. |
| 548 | + |
| 549 | + 12. No Surrender of Others' Freedom. |
| 550 | + |
| 551 | + If conditions are imposed on you (whether by court order, agreement or |
| 552 | +otherwise) that contradict the conditions of this License, they do not |
| 553 | +excuse you from the conditions of this License. If you cannot convey a |
| 554 | +covered work so as to satisfy simultaneously your obligations under this |
| 555 | +License and any other pertinent obligations, then as a consequence you may |
| 556 | +not convey it at all. For example, if you agree to terms that obligate you |
| 557 | +to collect a royalty for further conveying from those to whom you convey |
| 558 | +the Program, the only way you could satisfy both those terms and this |
| 559 | +License would be to refrain entirely from conveying the Program. |
| 560 | + |
| 561 | + 13. Use with the GNU Affero General Public License. |
| 562 | + |
| 563 | + Notwithstanding any other provision of this License, you have |
| 564 | +permission to link or combine any covered work with a work licensed |
| 565 | +under version 3 of the GNU Affero General Public License into a single |
| 566 | +combined work, and to convey the resulting work. The terms of this |
| 567 | +License will continue to apply to the part which is the covered work, |
| 568 | +but the special requirements of the GNU Affero General Public License, |
| 569 | +section 13, concerning interaction through a network will apply to the |
| 570 | +combination as such. |
| 571 | + |
| 572 | + 14. Revised Versions of this License. |
| 573 | + |
| 574 | + The Free Software Foundation may publish revised and/or new versions of |
| 575 | +the GNU General Public License from time to time. Such new versions will |
| 576 | +be similar in spirit to the present version, but may differ in detail to |
| 577 | +address new problems or concerns. |
| 578 | + |
| 579 | + Each version is given a distinguishing version number. If the |
| 580 | +Program specifies that a certain numbered version of the GNU General |
| 581 | +Public License "or any later version" applies to it, you have the |
| 582 | +option of following the terms and conditions either of that numbered |
| 583 | +version or of any later version published by the Free Software |
| 584 | +Foundation. If the Program does not specify a version number of the |
| 585 | +GNU General Public License, you may choose any version ever published |
| 586 | +by the Free Software Foundation. |
| 587 | + |
| 588 | + If the Program specifies that a proxy can decide which future |
| 589 | +versions of the GNU General Public License can be used, that proxy's |
| 590 | +public statement of acceptance of a version permanently authorizes you |
| 591 | +to choose that version for the Program. |
| 592 | + |
| 593 | + Later license versions may give you additional or different |
| 594 | +permissions. However, no additional obligations are imposed on any |
| 595 | +author or copyright holder as a result of your choosing to follow a |
| 596 | +later version. |
| 597 | + |
| 598 | + 15. Disclaimer of Warranty. |
| 599 | + |
| 600 | + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
| 601 | +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
| 602 | +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
| 603 | +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
| 604 | +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 605 | +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
| 606 | +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
| 607 | +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
| 608 | + |
| 609 | + 16. Limitation of Liability. |
| 610 | + |
| 611 | + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
| 612 | +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
| 613 | +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
| 614 | +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
| 615 | +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
| 616 | +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
| 617 | +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
| 618 | +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
| 619 | +SUCH DAMAGES. |
| 620 | + |
| 621 | + 17. Interpretation of Sections 15 and 16. |
| 622 | + |
| 623 | + If the disclaimer of warranty and limitation of liability provided |
| 624 | +above cannot be given local legal effect according to their terms, |
| 625 | +reviewing courts shall apply local law that most closely approximates |
| 626 | +an absolute waiver of all civil liability in connection with the |
| 627 | +Program, unless a warranty or assumption of liability accompanies a |
| 628 | +copy of the Program in return for a fee. |
| 629 | + |
| 630 | + END OF TERMS AND CONDITIONS |
| 631 | + |
| 632 | + How to Apply These Terms to Your New Programs |
| 633 | + |
| 634 | + If you develop a new program, and you want it to be of the greatest |
| 635 | +possible use to the public, the best way to achieve this is to make it |
| 636 | +free software which everyone can redistribute and change under these terms. |
| 637 | + |
| 638 | + To do so, attach the following notices to the program. It is safest |
| 639 | +to attach them to the start of each source file to most effectively |
| 640 | +state the exclusion of warranty; and each file should have at least |
| 641 | +the "copyright" line and a pointer to where the full notice is found. |
| 642 | + |
| 643 | + <one line to give the program's name and a brief idea of what it does.> |
| 644 | + Copyright (C) <year> <name of author> |
| 645 | + |
| 646 | + This program is free software: you can redistribute it and/or modify |
| 647 | + it under the terms of the GNU General Public License as published by |
| 648 | + the Free Software Foundation, either version 3 of the License, or |
| 649 | + (at your option) any later version. |
| 650 | + |
| 651 | + This program is distributed in the hope that it will be useful, |
| 652 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 653 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 654 | + GNU General Public License for more details. |
| 655 | + |
| 656 | + You should have received a copy of the GNU General Public License |
| 657 | + along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 658 | + |
| 659 | +Also add information on how to contact you by electronic and paper mail. |
| 660 | + |
| 661 | + If the program does terminal interaction, make it output a short |
| 662 | +notice like this when it starts in an interactive mode: |
| 663 | + |
| 664 | + <program> Copyright (C) <year> <name of author> |
| 665 | + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
| 666 | + This is free software, and you are welcome to redistribute it |
| 667 | + under certain conditions; type `show c' for details. |
| 668 | + |
| 669 | +The hypothetical commands `show w' and `show c' should show the appropriate |
| 670 | +parts of the General Public License. Of course, your program's commands |
| 671 | +might be different; for a GUI interface, you would use an "about box". |
| 672 | + |
| 673 | + You should also get your employer (if you work as a programmer) or school, |
| 674 | +if any, to sign a "copyright disclaimer" for the program, if necessary. |
| 675 | +For more information on this, and how to apply and follow the GNU GPL, see |
| 676 | +<http://www.gnu.org/licenses/>. |
| 677 | + |
| 678 | + The GNU General Public License does not permit incorporating your program |
| 679 | +into proprietary programs. If your program is a subroutine library, you |
| 680 | +may consider it more useful to permit linking proprietary applications with |
| 681 | +the library. If this is what you want to do, use the GNU Lesser General |
| 682 | +Public License instead of this License. But first, please read |
| 683 | +<http://www.gnu.org/philosophy/why-not-lgpl.html>. |
\ No newline at end of file |
Index: tags/extensions/LiveTranslate/REL_0_3/api/ApiQueryLiveTranslate.php |
— | — | @@ -0,0 +1,105 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * API module to get special words for a language stored by the Live Translate extension. |
| 6 | + * |
| 7 | + * @since 0.2 |
| 8 | + * |
| 9 | + * @file ApiQueryLiveTranslate.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 13 | + */ |
| 14 | +class ApiQueryLiveTranslate extends ApiQueryBase { |
| 15 | + public function __construct( $main, $action ) { |
| 16 | + parent :: __construct( $main, $action, 'lt' ); |
| 17 | + } |
| 18 | + |
| 19 | + /** |
| 20 | + * Retrieve the specil words from the database. |
| 21 | + */ |
| 22 | + public function execute() { |
| 23 | + // Get the requests parameters. |
| 24 | + $params = $this->extractRequestParams(); |
| 25 | + |
| 26 | + if ( !isset( $params['language'] ) ) { |
| 27 | + $this->dieUsageMsg( array( 'missingparam', 'language' ) ); |
| 28 | + } |
| 29 | + |
| 30 | + $specialWords = LiveTranslateFunctions::getSpecialWordsForLang( $params['language'] ); |
| 31 | + |
| 32 | + $toggeledSpecials = array(); |
| 33 | + |
| 34 | + foreach ( $specialWords as $word ) { |
| 35 | + $toggledWord = LiveTranslateFunctions::getToggledCase( $word ); |
| 36 | + |
| 37 | + if ( $toggledWord ) { |
| 38 | + $toggeledSpecials[] = $toggledWord; |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + foreach ( array_unique( array_merge( $specialWords, $toggeledSpecials ) ) as $word ) { |
| 43 | + $this->getResult()->addValue( |
| 44 | + 'words', |
| 45 | + null, |
| 46 | + $word |
| 47 | + ); |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * (non-PHPdoc) |
| 53 | + * @see includes/api/ApiBase#getAllowedParams() |
| 54 | + */ |
| 55 | + public function getAllowedParams() { |
| 56 | + return array ( |
| 57 | + 'language' => array( |
| 58 | + ApiBase::PARAM_TYPE => 'string', |
| 59 | + //ApiBase::PARAM_REQUIRED => true, |
| 60 | + ), |
| 61 | + ); |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * (non-PHPdoc) |
| 66 | + * @see includes/api/ApiBase#getParamDescription() |
| 67 | + */ |
| 68 | + public function getParamDescription() { |
| 69 | + return array ( |
| 70 | + 'language' => 'The language for which to return special words', |
| 71 | + ); |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * (non-PHPdoc) |
| 76 | + * @see includes/api/ApiBase#getDescription() |
| 77 | + */ |
| 78 | + public function getDescription() { |
| 79 | + return 'This module returns all special words defined in the wikis Live Translate Dictionary for a given language'; |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * (non-PHPdoc) |
| 84 | + * @see includes/api/ApiBase#getPossibleErrors() |
| 85 | + */ |
| 86 | + public function getPossibleErrors() { |
| 87 | + return array_merge( parent::getPossibleErrors(), array( |
| 88 | + array( 'missingparam', 'language' ), |
| 89 | + ) ); |
| 90 | + } |
| 91 | + |
| 92 | + /** |
| 93 | + * (non-PHPdoc) |
| 94 | + * @see includes/api/ApiBase#getExamples() |
| 95 | + */ |
| 96 | + protected function getExamples() { |
| 97 | + return array ( |
| 98 | + 'api.php?action=query&list=livetranslate<language', |
| 99 | + ); |
| 100 | + } |
| 101 | + |
| 102 | + public function getVersion() { |
| 103 | + return __CLASS__ . ': $Id: ApiQueryLiveTranslate.php 78939 2010-12-24 00:21:45Z jeroendedauw $'; |
| 104 | + } |
| 105 | + |
| 106 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_0_3/api/ApiQueryLiveTranslate.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 107 | + native |
Index: tags/extensions/LiveTranslate/REL_0_3/api/ApiLiveTranslate.php |
— | — | @@ -0,0 +1,138 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * API module to get special translations stored by the Live Translate extension. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file ApiLiveTranslate.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 13 | + */ |
| 14 | +class ApiLiveTranslate extends ApiBase { |
| 15 | + |
| 16 | + public function __construct( $main, $action ) { |
| 17 | + parent::__construct( $main, $action ); |
| 18 | + } |
| 19 | + |
| 20 | + public function execute() { |
| 21 | + $params = $this->extractRequestParams(); |
| 22 | + |
| 23 | + // In MW 1.17 and above ApiBase::PARAM_REQUIRED can be used, this is for b/c with 1.16. |
| 24 | + foreach ( array( 'from', 'to', 'words' ) as $requiredParam ) { |
| 25 | + if ( !isset( $params[$requiredParam] ) ) { |
| 26 | + $this->dieUsageMsg( array( 'missingparam', $requiredParam ) ); |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + $dbr = wfGetDB( DB_SLAVE ); |
| 31 | + |
| 32 | + foreach ( array_unique( $params['words'] ) as $word ) { |
| 33 | + $source = $dbr->selectRow( |
| 34 | + 'live_translate', |
| 35 | + array( 'word_id' ), |
| 36 | + array( |
| 37 | + 'word_language' => $params['from'], |
| 38 | + 'word_translation' => $word |
| 39 | + ) |
| 40 | + ); |
| 41 | + |
| 42 | + $toggledWord = false; |
| 43 | + |
| 44 | + if ( !$source ) { |
| 45 | + $toggledWord = LiveTranslateFunctions::getToggledCase( $word ); |
| 46 | + |
| 47 | + if ( $toggledWord ) { |
| 48 | + $source = $dbr->selectRow( |
| 49 | + 'live_translate', |
| 50 | + array( 'word_id' ), |
| 51 | + array( |
| 52 | + 'word_language' => $params['from'], |
| 53 | + 'word_translation' => $toggledWord |
| 54 | + ) |
| 55 | + ); |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + if ( $source ) { |
| 60 | + $destination = $dbr->selectRow( |
| 61 | + 'live_translate', |
| 62 | + array( 'word_translation' ), |
| 63 | + array( |
| 64 | + 'word_language' => $params['to'], |
| 65 | + 'word_id' => $source->word_id, |
| 66 | + 'word_primary' => 1 |
| 67 | + ) |
| 68 | + ); |
| 69 | + |
| 70 | + if ( $destination ) { |
| 71 | + if ( $toggledWord ) { |
| 72 | + $translation = LiveTranslateFunctions::getToggledCase( $destination->word_translation ); |
| 73 | + |
| 74 | + if ( $translation ) { |
| 75 | + $destination->word_translation = $translation; |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + $this->getResult()->addValue( |
| 80 | + 'translations', |
| 81 | + $word, |
| 82 | + $destination->word_translation |
| 83 | + ); |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | + |
| 89 | + public function getAllowedParams() { |
| 90 | + return array( |
| 91 | + 'from' => array( |
| 92 | + ApiBase::PARAM_TYPE => 'string', |
| 93 | + //ApiBase::PARAM_REQUIRED => true, |
| 94 | + ), |
| 95 | + 'to' => array( |
| 96 | + ApiBase::PARAM_TYPE => 'string', |
| 97 | + //ApiBase::PARAM_REQUIRED => true, |
| 98 | + ), |
| 99 | + 'words' => array( |
| 100 | + ApiBase::PARAM_TYPE => 'string', |
| 101 | + ApiBase::PARAM_ISMULTI => true, |
| 102 | + //ApiBase::PARAM_REQUIRED => true, |
| 103 | + ), |
| 104 | + ); |
| 105 | + } |
| 106 | + |
| 107 | + public function getParamDescription() { |
| 108 | + return array( |
| 109 | + 'from' => 'Source language', |
| 110 | + 'to' => 'Destination language', |
| 111 | + 'words' => 'The words to translate. Delimitered by |', |
| 112 | + ); |
| 113 | + } |
| 114 | + |
| 115 | + public function getDescription() { |
| 116 | + return array( |
| 117 | + 'Returns the available translations of the provided words in the source language in the destiniation language.' |
| 118 | + ); |
| 119 | + } |
| 120 | + |
| 121 | + public function getPossibleErrors() { |
| 122 | + return array_merge( parent::getPossibleErrors(), array( |
| 123 | + array( 'missingparam', 'from' ), |
| 124 | + array( 'missingparam', 'to' ), |
| 125 | + array( 'missingparam', 'words' ), |
| 126 | + ) ); |
| 127 | + } |
| 128 | + |
| 129 | + protected function getExamples() { |
| 130 | + return array( |
| 131 | + 'api.php?action=livetranslate&from=English&to=Dutch&words=In|Your|Example', |
| 132 | + ); |
| 133 | + } |
| 134 | + |
| 135 | + public function getVersion() { |
| 136 | + return __CLASS__ . ': $Id: ApiLiveTranslate.php 78734 2010-12-21 20:29:41Z jeroendedauw $'; |
| 137 | + } |
| 138 | + |
| 139 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_0_3/api/ApiLiveTranslate.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 140 | + native |
Index: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate.sql |
— | — | @@ -0,0 +1,11 @@ |
| 2 | +-- MySQL version of the database schema for the Live Translate extension. |
| 3 | + |
| 4 | +-- Special translations table |
| 5 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/live_translate ( |
| 6 | + word_id INT(8) unsigned NOT NULL, |
| 7 | + word_language VARCHAR(255) NOT NULL, |
| 8 | + word_translation VARCHAR(255) NOT NULL, |
| 9 | + word_primary INT(1) unsigned NOT NULL |
| 10 | +) /*$wgDBTableOptions*/; |
| 11 | + |
| 12 | +CREATE INDEX word_translation ON /*$wgDBprefix*/live_translate (word_id, word_language); |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_0_3/LiveTranslate.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 13 | + native |
Index: tags/extensions/LiveTranslate/REL_0_3/README |
— | — | @@ -0,0 +1,47 @@ |
| 2 | +These is the readme file for the Live Translate extension. |
| 3 | + |
| 4 | +Extension page on mediawiki.org: http://www.mediawiki.org/wiki/Extension:Live_Translate |
| 5 | +Latest version of the readme file: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/LiveTranslate/README?view=co |
| 6 | + |
| 7 | +== About == |
| 8 | + |
| 9 | +Live Translate is a lightweight extension to live translate articles using the Google Translate service. |
| 10 | + |
| 11 | +== Usage == |
| 12 | + |
| 13 | +Live Translate adds a "Translate" button to the top right-hand corner of wiki pages, together with a dropdown |
| 14 | +menu that allows you to select the target language. Hitting the "Translate" button will cause the text in the |
| 15 | +wiki page to be translated to the selected destination language within the browser (it will not modify the |
| 16 | +original source text in any way). The source language will be assumed to be the wiki's main language, unless |
| 17 | +the wiki page's name ends with a "/" and then a language code, e.g., "Main Page/de" - if that is the case, the |
| 18 | +wiki page's language will be assumed to be the one that corresponds to that language code. |
| 19 | + |
| 20 | +After a user hits the "Translate" button, another button, "Show original", will appear, which if pressed will |
| 21 | +return the display to its original language. |
| 22 | + |
| 23 | +=== Defining a translation dictionary === |
| 24 | + |
| 25 | +You can define a dictionary of "special words" for which you provide translations, and that will then be left |
| 26 | +alone by Google Translate. This dictionary is defined in a page within the wiki; by default the page is named |
| 27 | +"Live Translate Dictionary", but this name can be changed in LocalSettings.php. The contents of the page should |
| 28 | +be a list in CSV (comma-separated values) format, where the first row contains the set of relevant language codes, |
| 29 | +and the successive ones the translations. An example would be: |
| 30 | + |
| 31 | +<pre> |
| 32 | +en, nl, de |
| 33 | +Hello world, Hallo wereld, Hallo welt |
| 34 | +Awesome, Geweldig, Große |
| 35 | +</pre> |
| 36 | + |
| 37 | +The dictionary supports defining synonyms. You can add them using the | sign as delimiter. For example, if you |
| 38 | +want "fantastic" to be translated the same as "awesome", the above dictionary would change to: |
| 39 | + |
| 40 | +<pre> |
| 41 | +en, nl, de |
| 42 | +Hello world, Hallo wereld, Hallo welt |
| 43 | +Awesome|fantastic, Geweldig, Große |
| 44 | +</pre> |
| 45 | + |
| 46 | +This means that "fantastic" will be "handled" exactly the same as "Awesome" when translating from English to |
| 47 | +one of the other languages. When translating to English, the first word in the synonym list, in this case |
| 48 | +"Awesome", will be used. So translating the Dutch "Geweldig" to English will result in "Awesome". |