Index: tags/extensions/LiveTranslate/REL_1_1_1/sql/LT_IndexWordTranslation.sql |
— | — | @@ -0,0 +1 @@ |
| 2 | +CREATE INDEX word_translation ON /*$wgDBprefix*/live_translate (word_id, word_language); |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/sql/LT_IndexWordTranslation.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 3 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/sql/LT_addTMField.sql |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +ALTER TABLE /*_*/live_translate ADD COLUMN memory_id INT(4) unsigned NOT NULL; |
| 3 | +UPDATE /*_*/live_translate SET memory_id = 1; |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/sql/LT_addTMField.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 4 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.i18n.magic.php |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Internationalization file for the magic words in the Live Translate extension. |
| 6 | + * |
| 7 | + * @file LiveTranslate.i18n.magic.php |
| 8 | + * @ingroup LiveTranslate |
| 9 | + * |
| 10 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 11 | + */ |
| 12 | + |
| 13 | +$magicWords = array(); |
| 14 | + |
| 15 | +/** English (English) |
| 16 | + * @author Jeroen De Dauw |
| 17 | + */ |
| 18 | +$magicWords['en'] = array( |
| 19 | + 'LT_NOTRANSLATIONCONTROL' => array( 0, '__NOTRANSLATIONCONTROL__' ), |
| 20 | + 'LT_SHOWTRANSLATIONCONTROL' => array( 0, '__SHOWTRANSLATIONCONTROL__' ), |
| 21 | +); |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.i18n.magic.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 22 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.i18n.php |
— | — | @@ -0,0 +1,1003 @@ |
| 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 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modify]] the list of translation memories', |
| 21 | + |
| 22 | + // Translation interface |
| 23 | + 'livetranslate-translate-to' => 'Translate this page to', |
| 24 | + 'livetranslate-button-translate' => 'Translate', |
| 25 | + 'livetranslate-button-translating' => 'Translating...', |
| 26 | + 'livetranslate-button-revert' => 'Show original', |
| 27 | + 'livetranslate-dictionary-error' => 'Could not obtain the live translate dictionary. No words will be treated as special during the translation process.', |
| 28 | + |
| 29 | + // Special words dictionary |
| 30 | + 'livetranslate-dictionary-empty' => 'There are no words in the dictionary yet. Click the "edit" tab to add some.', |
| 31 | + '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.', |
| 32 | + '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.', |
| 33 | + 'livetranslate-dictionary-goto-edit' => 'Modify the translation memories.', |
| 34 | + |
| 35 | + // Special:LiveTranslate |
| 36 | + 'special-livetranslate' => 'Live translate', |
| 37 | + 'livetranslate-tmtype-ltf' => 'Live Translate format', |
| 38 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 39 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 40 | + 'livetranslate-special-no-tms-yet' => 'There are no translation memories yet.', |
| 41 | + 'livetranslate-special-button' => 'Save and update', |
| 42 | + 'livetranslate-special-type' => 'Type', |
| 43 | + 'livetranslate-special-location' => 'Location', |
| 44 | + 'livetranslate-special-remove' => 'Remove', |
| 45 | + 'livetranslate-special-local' => 'Local', |
| 46 | + 'livetranslate-special-add-tm' => 'Add a new translation memory', |
| 47 | + 'livetranslate-special-current-tms' => 'Existing translation memories', |
| 48 | + 'livetranslate-special-tms-update' => 'Update translation memories', |
| 49 | + 'livetranslate-special-update' => 'Update translation memories', |
| 50 | + |
| 51 | + // API ImportTranslationMemories |
| 52 | + 'livetranslate-importtms-param-miscmatch' => 'Mismatch between amount of locations and types', |
| 53 | +); |
| 54 | + |
| 55 | +/** Message documentation (Message documentation) |
| 56 | + * @author EugeneZelenko |
| 57 | + * @author Jeroen De Dauw |
| 58 | + * @author Purodha |
| 59 | + * @author Raymond |
| 60 | + */ |
| 61 | +$messages['qqq'] = array( |
| 62 | + 'livetranslate-desc' => '{{desc}}', |
| 63 | + 'livetranslate-translate-to' => 'There is an [https://secure.wikimedia.org/wikipedia/mediawiki/wiki/File:Lte-article.png example screenshot of use]. |
| 64 | +Look at the right side in the line below the ruler under the "Main Page" header.', |
| 65 | + 'livetranslate-button-translate' => 'There is an [https://secure.wikimedia.org/wikipedia/mediawiki/wiki/File:Lte-article.png example screenshot of use]. |
| 66 | +Look at the right edge in the line below the ruler under the "Main Page" header.', |
| 67 | + 'livetranslate-special-type' => 'Table column header on Special:LiveTranslate |
| 68 | + |
| 69 | +{{Identical|Type}}', |
| 70 | + 'livetranslate-special-location' => '{{Identical|Location}} |
| 71 | + |
| 72 | +Table column header on Special:LiveTranslate', |
| 73 | + 'livetranslate-special-remove' => '{{Identical|Remove}}', |
| 74 | + 'livetranslate-special-local' => 'Table column header on Special:LiveTranslate', |
| 75 | + 'livetranslate-importtms-param-miscmatch' => 'Error message for when one of the API modules gets called with a different amount of translation memory types compared to the amount of translation memory names', |
| 76 | +); |
| 77 | + |
| 78 | +/** Afrikaans (Afrikaans) |
| 79 | + * @author Naudefj |
| 80 | + */ |
| 81 | +$messages['af'] = array( |
| 82 | + 'livetranslate-translate-to' => 'Vertaal die bladsy na', |
| 83 | + 'livetranslate-button-translate' => 'Vertaal', |
| 84 | + 'livetranslate-button-translating' => 'Besig met vertaling...', |
| 85 | + 'livetranslate-button-revert' => 'Wys oorspronklike', |
| 86 | + 'livetranslate-special-no-tms-yet' => 'Daar is nog geen vertaalgeheues nie.', |
| 87 | + 'livetranslate-special-button' => 'Stoor en opdateer', |
| 88 | + 'livetranslate-special-type' => 'Tipe', |
| 89 | + 'livetranslate-special-location' => 'Ligging', |
| 90 | + 'livetranslate-special-remove' => 'Verwyder', |
| 91 | + 'livetranslate-special-local' => 'Lokaal', |
| 92 | +); |
| 93 | + |
| 94 | +/** Azerbaijani (Azərbaycanca) |
| 95 | + * @author Cekli829 |
| 96 | + */ |
| 97 | +$messages['az'] = array( |
| 98 | + 'livetranslate-button-translate' => 'Tərcümə et', |
| 99 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 100 | + 'livetranslate-special-type' => 'Tipi', |
| 101 | + 'livetranslate-special-remove' => 'Çıxar', |
| 102 | + 'livetranslate-special-local' => 'Lokal', |
| 103 | +); |
| 104 | + |
| 105 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
| 106 | + * @author EugeneZelenko |
| 107 | + * @author Jim-by |
| 108 | + * @author Wizardist |
| 109 | + */ |
| 110 | +$messages['be-tarask'] = array( |
| 111 | + 'livetranslate-desc' => 'Дазваляе пераклады тэкстаў старонак на ляту ў Google Translate', |
| 112 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|зьмена]] сьпісу памяці перакладаў', |
| 113 | + 'livetranslate-translate-to' => 'Перакласьці гэту старонку на', |
| 114 | + 'livetranslate-button-translate' => 'Перакласьці', |
| 115 | + 'livetranslate-button-translating' => 'Ідзе пераклад…', |
| 116 | + 'livetranslate-button-revert' => 'Паказаць арыгінал', |
| 117 | + 'livetranslate-dictionary-error' => 'Немагчыма атрымаць слоўнік перакладу на ляту. Няма словаў, якая будуць разглядацца як спэцыяльныя, падчас працэсу перакладу.', |
| 118 | + 'livetranslate-dictionary-empty' => 'Пакуль што няма словаў у слоўніку. Націсьніце кнопку «рэдагаваць» каб дадаць.', |
| 119 | + 'livetranslate-dictionary-count' => 'Ёсьць $1 {{PLURAL:$1|слова|словы|словаў}} у $2 {{PLURAL:$2|мове|мовах|мовах}}. Націсьніце кнопку «рэдагаваць» каб дадаць болей.', |
| 120 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Гэтая мова не дазволеная|Гэтыя мовы не дазволеныя}} у цяперашні момант як мэтавыя для перакладу: $1. Зьмяніце дазволеныя мовы ў Вашых наладах {{GRAMMAR:родны|{{SITENAME}}}}, ці выдаліце са слоўніка.', |
| 121 | + 'livetranslate-dictionary-goto-edit' => 'Зьмяніць памяці перакладаў.', |
| 122 | + 'special-livetranslate' => 'Пераклад на ляту', |
| 123 | + 'livetranslate-tmtype-ltf' => 'Фармат перакладу на ляту', |
| 124 | + 'livetranslate-tmtype-tmx' => 'Абмен памяцьцю перакладаў', |
| 125 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 126 | + 'livetranslate-special-no-tms-yet' => 'Пакуль што няма памяці перакладаў.', |
| 127 | + 'livetranslate-special-button' => 'Захаваць і абнавіць', |
| 128 | + 'livetranslate-special-type' => 'Тып', |
| 129 | + 'livetranslate-special-location' => 'Месцазнаходжаньне', |
| 130 | + 'livetranslate-special-remove' => 'Выдаліць', |
| 131 | + 'livetranslate-special-local' => 'Лякальная', |
| 132 | + 'livetranslate-special-add-tm' => 'Дадаць новую памяць перакладаў', |
| 133 | + 'livetranslate-special-current-tms' => 'Існуючыя памяці перакладаў', |
| 134 | + 'livetranslate-special-tms-update' => 'Абнавіць памяці перакладаў', |
| 135 | + 'livetranslate-special-update' => 'Абнавіць памяці перакладаў', |
| 136 | + 'livetranslate-importtms-param-miscmatch' => 'Несупадзеньне паміж колькасьцю знаходжаньняў і тыпамі', |
| 137 | +); |
| 138 | + |
| 139 | +/** Bulgarian (Български) |
| 140 | + * @author DCLXVI |
| 141 | + */ |
| 142 | +$messages['bg'] = array( |
| 143 | + 'livetranslate-button-translate' => 'Превеждане', |
| 144 | + 'livetranslate-button-translating' => 'Превеждане...', |
| 145 | + 'livetranslate-special-remove' => 'Премахване', |
| 146 | +); |
| 147 | + |
| 148 | +/** Bengali (বাংলা) |
| 149 | + * @author Wikitanvir |
| 150 | + */ |
| 151 | +$messages['bn'] = array( |
| 152 | + 'livetranslate-button-translate' => 'অনুবাদ', |
| 153 | + 'livetranslate-button-translating' => 'অনুবাদ করা হচ্ছে...', |
| 154 | + 'livetranslate-button-revert' => 'মূলটি দেখাও', |
| 155 | + 'special-livetranslate' => 'সরাসরি অনুবাদ', |
| 156 | + 'livetranslate-tmtype-ltf' => 'সরাসরি অনুবাদের ফরম্যাট', |
| 157 | + 'livetranslate-tmtype-gcsv' => 'গুগল সিএসভি', |
| 158 | + 'livetranslate-special-no-tms-yet' => 'এখনও কোনো অনুবাদ মেমোরি নেই।', |
| 159 | + 'livetranslate-special-button' => 'সংরক্ষণ ও হালনাগাদ', |
| 160 | + 'livetranslate-special-type' => 'ধরন', |
| 161 | + 'livetranslate-special-location' => 'অবস্থান', |
| 162 | + 'livetranslate-special-remove' => 'অপসারণ', |
| 163 | + 'livetranslate-special-local' => 'স্থানীয়', |
| 164 | + 'livetranslate-special-add-tm' => 'নতুন অনুবাদ মেমোরি যোগ করো', |
| 165 | + 'livetranslate-special-current-tms' => 'ইতিমধ্যেই থাকা অনুবাদ মেমোরিসমূহ', |
| 166 | + 'livetranslate-special-tms-update' => 'অনুবাদ মেমোরিসমূহ হালনাগাদ করুন', |
| 167 | + 'livetranslate-special-update' => 'অনুবাদ মেমোরিসমূহ হালনাগাদ করুন', |
| 168 | +); |
| 169 | + |
| 170 | +/** Breton (Brezhoneg) |
| 171 | + * @author Fulup |
| 172 | + */ |
| 173 | +$messages['br'] = array( |
| 174 | + 'livetranslate-desc' => 'Aotren a ra treiñ danvez ur bajenn war-eeun en ur ober gant servij treiñ Google', |
| 175 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Kemmañ]] roll ar memorioù treiñ', |
| 176 | + 'livetranslate-translate-to' => 'Treiñ ar bajenn-mañ e', |
| 177 | + 'livetranslate-button-translate' => 'Treiñ', |
| 178 | + 'livetranslate-button-translating' => 'O treiñ...', |
| 179 | + 'livetranslate-button-revert' => 'Diskouez ar stumm orin', |
| 180 | + 'livetranslate-dictionary-error' => 'Dibosupl kavout troidigezh ar geriadur war ar prim. Ne vo pledet gant ger ebet en un doare dibar e-keit ha ne vo ket bet sevenet an droidigezh.', |
| 181 | + 'livetranslate-dictionary-empty' => 'Ger ebet er geriadur evit c\'hoazh. Klikit war an ivinell "kemmañ" evit ouzhpennañ unan.', |
| 182 | + 'livetranslate-dictionary-count' => '{{PLURAL:$1|$1 ger|$1 ger}} e $2 {{PLURAL:$2|yezh|yezh}} zo. Klikañ war an ivinell "kemmañ" da zegas re all.', |
| 183 | + 'livetranslate-dictionary-unallowed-langs' => "N'eo ket bet dibabet ar {{PLURAL:$2|yezh-mañ|ar yezhoù-mañ}} da yezh(où) da dreiñ daveto evit c'hoazh : $1. Cheñchit ar yezhoù aotreet dre ho kefluniadur wiki pe lamit anezho kuit eus ar geriadur.", |
| 184 | + 'livetranslate-dictionary-goto-edit' => 'Kemmañ ar memorioù treiñ.', |
| 185 | + 'special-livetranslate' => 'Live translate', |
| 186 | + 'livetranslate-tmtype-ltf' => 'Furmad Live Translate', |
| 187 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 188 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 189 | + 'livetranslate-special-no-tms-yet' => "N'eus tamm memor treiñ ebet evit c'hoazh", |
| 190 | + 'livetranslate-special-button' => 'Enrollañ hag hizivaat', |
| 191 | + 'livetranslate-special-type' => 'Seurt', |
| 192 | + 'livetranslate-special-location' => "Lec'hiadur", |
| 193 | + 'livetranslate-special-remove' => 'Dilemel', |
| 194 | + 'livetranslate-special-local' => "Lec'hel", |
| 195 | + 'livetranslate-special-add-tm' => 'Ouzhpennañ ur memor treiñ nevez', |
| 196 | + 'livetranslate-special-current-tms' => 'Memorioù treiñ hegerz', |
| 197 | + 'livetranslate-special-tms-update' => 'Hizivaat ar memorioù treiñ', |
| 198 | + 'livetranslate-special-update' => 'Hizivaat ar memorioù treiñ', |
| 199 | + 'livetranslate-importtms-param-miscmatch' => "Disklot etre ar c'hementad a lec'hiadurioù hag ar seurtoù", |
| 200 | +); |
| 201 | + |
| 202 | +/** Bosnian (Bosanski) |
| 203 | + * @author CERminator |
| 204 | + */ |
| 205 | +$messages['bs'] = array( |
| 206 | + 'livetranslate-desc' => 'Omogućuje prevođenje uživo sadržaja stranice koristeći uslugu Google Translate', |
| 207 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Mijenjanje]] spiska memorije za prevođenje', |
| 208 | + 'livetranslate-translate-to' => 'Prevedi ovu stranicu na', |
| 209 | + 'livetranslate-button-translate' => 'Prevedi', |
| 210 | + 'livetranslate-button-translating' => 'Prevodim...', |
| 211 | + 'livetranslate-button-revert' => 'Prikaži original', |
| 212 | + '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.', |
| 213 | + 'livetranslate-dictionary-empty' => "Još uvijek nema riječi u rječniku. Kliknite na jezičak ''uredi'' da ih dodate.", |
| 214 | + '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.', |
| 215 | + '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.', |
| 216 | + 'livetranslate-dictionary-goto-edit' => 'Izmijeni memorije prevoda.', |
| 217 | + 'special-livetranslate' => 'Prevođenje uživo', |
| 218 | + 'livetranslate-tmtype-ltf' => 'Format prevođenja uživo', |
| 219 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 220 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 221 | + 'livetranslate-special-no-tms-yet' => 'U memoriji još uvijek nema prevoda.', |
| 222 | + 'livetranslate-special-button' => 'Spremi i ažuriraj', |
| 223 | + 'livetranslate-special-type' => 'Vrsta', |
| 224 | + 'livetranslate-special-location' => 'Lokacija', |
| 225 | + 'livetranslate-special-remove' => 'Ukloni', |
| 226 | + 'livetranslate-special-local' => 'Lokalno', |
| 227 | + 'livetranslate-special-add-tm' => 'Dodaj novu memoriju prevoda', |
| 228 | + 'livetranslate-special-current-tms' => 'Postojeće memorije prevoda', |
| 229 | + 'livetranslate-special-tms-update' => 'Ažuriraj memorije prevoda', |
| 230 | + 'livetranslate-special-update' => 'Ažuriraj memorije prevoda', |
| 231 | + 'livetranslate-importtms-param-miscmatch' => 'Neslaganje između broja lokacija i vrsta', |
| 232 | +); |
| 233 | + |
| 234 | +/** German (Deutsch) |
| 235 | + * @author Kghbln |
| 236 | + * @author Purodha |
| 237 | + */ |
| 238 | +$messages['de'] = array( |
| 239 | + 'livetranslate-desc' => 'Ermöglicht die unmittelbare Übersetzung des Seiteninhalts mit „Google Übersetzer“', |
| 240 | + 'right-managetms' => 'Liste der Übersetzungsspeicher [[Special:SpecialLiveTranslate|anpassen]]', |
| 241 | + 'livetranslate-translate-to' => 'Diese Seite in folgende Sprache übersetzen:', |
| 242 | + 'livetranslate-button-translate' => 'Übersetze', |
| 243 | + 'livetranslate-button-translating' => 'Übersetze …', |
| 244 | + 'livetranslate-button-revert' => 'Originalinhalt anzeigen', |
| 245 | + '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.', |
| 246 | + 'livetranslate-dictionary-empty' => 'Momentan befinden sich keine Vokabeln im Wörterbuch. Auf „Bearbeiten“ klicken, um welche hinzuzufügen.', |
| 247 | + '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.', |
| 248 | + '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.', |
| 249 | + 'livetranslate-dictionary-goto-edit' => 'Die Übersetzungsspeicher anpassen.', |
| 250 | + 'special-livetranslate' => 'Direktübersetzung', |
| 251 | + 'livetranslate-tmtype-ltf' => 'Live Translate format', |
| 252 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 253 | + 'livetranslate-tmtype-gcsv' => 'Google-CSV', |
| 254 | + 'livetranslate-special-no-tms-yet' => 'Momentan sind noch keine Übersetzungsspeicher vorhanden.', |
| 255 | + 'livetranslate-special-button' => 'Speichern und aktualisieren', |
| 256 | + 'livetranslate-special-type' => 'Art', |
| 257 | + 'livetranslate-special-location' => 'Ort', |
| 258 | + 'livetranslate-special-remove' => 'Entfernen', |
| 259 | + 'livetranslate-special-local' => 'Lokal', |
| 260 | + 'livetranslate-special-add-tm' => 'Einen neuen Übersetzungsspeicher anlegen', |
| 261 | + 'livetranslate-special-current-tms' => 'Vorhandene Übersetzungsspeicher', |
| 262 | + 'livetranslate-special-tms-update' => 'Übersetzungsspeicher aktualisieren', |
| 263 | + 'livetranslate-special-update' => 'Übersetzungsspeicher aktualisieren', |
| 264 | + 'livetranslate-importtms-param-miscmatch' => 'Missverhältnis zwischen Anzahl an Übersetzungsspeichern und Übersetzungsspeicherarten', |
| 265 | +); |
| 266 | + |
| 267 | +/** Lower Sorbian (Dolnoserbski) |
| 268 | + * @author Michawiki |
| 269 | + */ |
| 270 | +$messages['dsb'] = array( |
| 271 | + 'livetranslate-desc' => 'Zmóžnja direktne pśełožowanje wopśimjeśa boka z pomocu słužby "Google Translate"', |
| 272 | + 'livetranslate-translate-to' => 'Pśełož toś ten boko do', |
| 273 | + 'livetranslate-button-translate' => 'Pśełožyś', |
| 274 | + 'livetranslate-button-translating' => 'Pśełožujo se...', |
| 275 | + 'livetranslate-button-revert' => 'Original pokazaś', |
| 276 | + 'livetranslate-dictionary-error' => 'Słownik za Live Translate njedajo se zacytaś. Jogo słowa njezapśimuju se za pśełožowański proces.', |
| 277 | + 'livetranslate-dictionary-empty' => 'Hyšći njejsu žedne słowa w słowniku. Klikni na rejtark "wobźěłaś", aby někotare dodał.', |
| 278 | + '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ł.', |
| 279 | + '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.', |
| 280 | + 'livetranslate-dictionary-goto-edit' => 'Pśełožowańske składowaki změniś.', |
| 281 | + 'special-livetranslate' => 'Direktne přełožowanje', |
| 282 | + 'livetranslate-tmtype-ltf' => 'Live Translate format', |
| 283 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 284 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 285 | + 'livetranslate-special-no-tms-yet' => 'Pśełožowańske składowaki hyšći njejsu.', |
| 286 | + 'livetranslate-special-button' => 'Składowaś a aktualizěrowaś', |
| 287 | + 'livetranslate-special-type' => 'Typ', |
| 288 | + 'livetranslate-special-location' => 'Městno', |
| 289 | + 'livetranslate-special-remove' => 'Wótpóraś', |
| 290 | + 'livetranslate-special-local' => 'Lokalny', |
| 291 | + 'livetranslate-special-add-tm' => 'Nowy pśełožowański składowak pśidaś', |
| 292 | + 'livetranslate-special-current-tms' => 'Eksistěrujuce pśełožowańske składowaki', |
| 293 | + 'livetranslate-special-tms-update' => 'Pséłožowańske składowaki aktualizěrowaś', |
| 294 | + 'livetranslate-special-update' => 'Pséłožowańske składowaki aktualizěrowaś', |
| 295 | + 'livetranslate-importtms-param-miscmatch' => 'Njedobry poměr mjazy licbu městnow a typow', |
| 296 | +); |
| 297 | + |
| 298 | +/** Basque (Euskara) |
| 299 | + * @author An13sa |
| 300 | + */ |
| 301 | +$messages['eu'] = array( |
| 302 | + 'livetranslate-button-translate' => 'Itzuli', |
| 303 | + 'livetranslate-button-translating' => 'Itzultzen...', |
| 304 | + 'livetranslate-button-revert' => 'Jatorrizkoa erakutsi', |
| 305 | +); |
| 306 | + |
| 307 | +/** French (Français) |
| 308 | + * @author Crochet.david |
| 309 | + * @author Sherbrooke |
| 310 | + */ |
| 311 | +$messages['fr'] = array( |
| 312 | + 'livetranslate-desc' => 'Permet la traduction immédiate du contenu de la page en utilisant le service de traduction de Google', |
| 313 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modifier]] la liste des mémoires de traduction', |
| 314 | + 'livetranslate-translate-to' => 'Traduire cette page en', |
| 315 | + 'livetranslate-button-translate' => 'Traduire', |
| 316 | + 'livetranslate-button-translating' => 'Traduction en cours...', |
| 317 | + 'livetranslate-button-revert' => 'Afficher l’original', |
| 318 | + '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.", |
| 319 | + 'livetranslate-dictionary-empty' => "Il n'y a aucun mot dans le dictionnaire encore. Cliquez sur l'onglet « Modifier » pour en ajouter.", |
| 320 | + '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.", |
| 321 | + 'livetranslate-dictionary-unallowed-langs' => "{{PLURAL:$2|Cette langue n'est pas sélectionnée comme langue cible|Ces langues ne sont pas sélectionnées comme langues cibles}} : $1. Modifiez les langues autorisées dans votre configuration de wiki ou supprimez-les du dictionnaire.", |
| 322 | + 'livetranslate-dictionary-goto-edit' => 'Modifier les mémoires de traduction.', |
| 323 | + 'special-livetranslate' => 'Live translate', |
| 324 | + 'livetranslate-tmtype-ltf' => 'Format Live Translate', |
| 325 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 326 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 327 | + 'livetranslate-special-no-tms-yet' => "Il n'ya pas de mémoires de traduction pour le moment.", |
| 328 | + 'livetranslate-special-button' => 'Enregistrer et mettre à jour', |
| 329 | + 'livetranslate-special-type' => 'Type', |
| 330 | + 'livetranslate-special-location' => 'Localisation', |
| 331 | + 'livetranslate-special-remove' => 'Enlever', |
| 332 | + 'livetranslate-special-local' => 'Local', |
| 333 | + 'livetranslate-special-add-tm' => 'Ajouter une nouvelle mémoire de traduction', |
| 334 | + 'livetranslate-special-current-tms' => 'Mémoires de traduction existantes', |
| 335 | + 'livetranslate-special-tms-update' => 'Mise à jour de mémoires de traduction', |
| 336 | + 'livetranslate-special-update' => 'Mise à jour de mémoires de traduction', |
| 337 | + 'livetranslate-importtms-param-miscmatch' => "Incompatibilité entre la quantité d'emplacements et les types", |
| 338 | +); |
| 339 | + |
| 340 | +/** Franco-Provençal (Arpetan) |
| 341 | + * @author ChrisPtDe |
| 342 | + */ |
| 343 | +$messages['frp'] = array( |
| 344 | + 'livetranslate-translate-to' => 'Traduire ceta pâge en', |
| 345 | + 'livetranslate-button-translate' => 'Traduire', |
| 346 | + 'livetranslate-button-translating' => 'Traduccion en cors...', |
| 347 | + 'livetranslate-button-revert' => 'Fâre vêre l’originâl', |
| 348 | + 'livetranslate-dictionary-goto-edit' => 'Changiér les mèmouères de traduccion.', |
| 349 | + 'special-livetranslate' => 'Traduccion en dirèct', |
| 350 | + 'livetranslate-tmtype-ltf' => 'Format de la traduccion en dirèct', |
| 351 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 352 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 353 | + 'livetranslate-special-no-tms-yet' => 'Y at gins de mèmouère de traduccion por lo moment.', |
| 354 | + 'livetranslate-special-button' => 'Encartar et betar a jorn', |
| 355 | + 'livetranslate-special-type' => 'Tipo', |
| 356 | + 'livetranslate-special-location' => 'Localisacion', |
| 357 | + 'livetranslate-special-remove' => 'Enlevar', |
| 358 | + 'livetranslate-special-local' => 'Local', |
| 359 | + 'livetranslate-special-add-tm' => 'Apondre una novèla mèmouère de traduccion', |
| 360 | + 'livetranslate-special-current-tms' => 'Mèmouères de traduccion ègzistentes', |
| 361 | + 'livetranslate-special-tms-update' => 'Betar a jorn des mèmouères de traduccion', |
| 362 | + 'livetranslate-special-update' => 'Betar a jorn des mèmouères de traduccion', |
| 363 | +); |
| 364 | + |
| 365 | +/** Galician (Galego) |
| 366 | + * @author Toliño |
| 367 | + */ |
| 368 | +$messages['gl'] = array( |
| 369 | + 'livetranslate-desc' => 'Activa a tradución en vivo do contido dunha páxina mediante o servizo de tradución do Google', |
| 370 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modificar]] a lista de memorias de tradución', |
| 371 | + 'livetranslate-translate-to' => 'Traducir esta páxina ao', |
| 372 | + 'livetranslate-button-translate' => 'Traducir', |
| 373 | + 'livetranslate-button-translating' => 'Traducindo...', |
| 374 | + 'livetranslate-button-revert' => 'Mostrar o orixinal', |
| 375 | + 'livetranslate-dictionary-error' => 'Non se puido acceder ao dicionario de tradución en vivo. Durante o proceso de tradución, ningunha palabra recibirá un trato especial.', |
| 376 | + 'livetranslate-dictionary-empty' => 'Aínda non hai palabras no dicionario. Prema na lapela "Editar" para engadir algunha.', |
| 377 | + 'livetranslate-dictionary-count' => 'Hai $1 {{PLURAL:$1|palabra|palabras}} {{PLURAL:$2|nunha lingua|en $2 linguas}}. Prema na lapela "Editar" para engadir máis.', |
| 378 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Esta lingua non está establecida como destino de tradución válido|Estas linguas non están establecidas como destinos de tradución válidos}}: $1. Modifique as linguas permitidas na configuración do seu wiki ou elimíneas do dicionario.', |
| 379 | + 'livetranslate-dictionary-goto-edit' => 'Modificar as memorias de tradución.', |
| 380 | + 'special-livetranslate' => 'Tradución en vivo', |
| 381 | + 'livetranslate-tmtype-ltf' => 'Formato da tradución en vivo', |
| 382 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 383 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 384 | + 'livetranslate-special-no-tms-yet' => 'Aínda non hai memorias de tradución.', |
| 385 | + 'livetranslate-special-button' => 'Gardar e actualizar', |
| 386 | + 'livetranslate-special-type' => 'Tipo', |
| 387 | + 'livetranslate-special-location' => 'Localización', |
| 388 | + 'livetranslate-special-remove' => 'Eliminar', |
| 389 | + 'livetranslate-special-local' => 'Local', |
| 390 | + 'livetranslate-special-add-tm' => 'Engadir unha nova memoria de tradución', |
| 391 | + 'livetranslate-special-current-tms' => 'Memorias de tradución existentes', |
| 392 | + 'livetranslate-special-tms-update' => 'Actualizar as memorias de tradución', |
| 393 | + 'livetranslate-special-update' => 'Actualizar as memorias de tradución', |
| 394 | + 'livetranslate-importtms-param-miscmatch' => 'Discordancia entre a cantidade de localizacións e os tipos', |
| 395 | +); |
| 396 | + |
| 397 | +/** Swiss German (Alemannisch) |
| 398 | + * @author Als-Holder |
| 399 | + */ |
| 400 | +$messages['gsw'] = array( |
| 401 | + 'livetranslate-desc' => 'Macht di diräkt Ibersetzig vum Syteninhalt megli mit „Google Ibersetzer“', |
| 402 | + 'livetranslate-translate-to' => 'Die Syte ibersetze in', |
| 403 | + 'livetranslate-button-translate' => 'Ibersetze', |
| 404 | + 'livetranslate-button-translating' => 'Am Ibersetze …', |
| 405 | + 'livetranslate-button-revert' => 'Originalinhalt aazeige', |
| 406 | + 'livetranslate-dictionary-error' => 'S Werterbuech het nit chenne glade wäre. Wäge däm wäre d Werter, wu s dert din het, bim Ibersetzigsvorgang nit berucksichtigt.', |
| 407 | + 'livetranslate-dictionary-empty' => 'Zurzyt het s kei Vokable im Werterbuech. Uf „Bearbeite“ klicke go ne baar yyfiege.', |
| 408 | + '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.', |
| 409 | + '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.', |
| 410 | + 'livetranslate-dictionary-goto-edit' => 'D Ibersetzigsspycher aapasse.', |
| 411 | + 'special-livetranslate' => 'Diräktibersetzig', |
| 412 | + 'livetranslate-tmtype-ltf' => 'Live Translate-Format', |
| 413 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 414 | + 'livetranslate-tmtype-gcsv' => 'Google-CSV', |
| 415 | + 'livetranslate-special-no-tms-yet' => 'S git no kei Ibersetzigsspycher.', |
| 416 | + 'livetranslate-special-button' => 'Spychere un aktualisiere', |
| 417 | + 'livetranslate-special-type' => 'Typ', |
| 418 | + 'livetranslate-special-location' => 'Ort', |
| 419 | + 'livetranslate-special-remove' => 'Uuseneh', |
| 420 | + 'livetranslate-special-local' => 'Lokal', |
| 421 | + 'livetranslate-special-add-tm' => 'E neje Ibersetzigsspycher aalege', |
| 422 | + 'livetranslate-special-current-tms' => 'Ibersetzigsspycher, wu s het', |
| 423 | + 'livetranslate-special-tms-update' => 'Ibersetzigsspycher aktualisiere', |
| 424 | + 'livetranslate-special-update' => 'Ibersetzigsspycher aktualisiere', |
| 425 | + 'livetranslate-importtms-param-miscmatch' => 'Missverhältnis zwische dr Aazahl vu Spycherplätz un Type', |
| 426 | +); |
| 427 | + |
| 428 | +/** Hebrew (עברית) |
| 429 | + * @author Amire80 |
| 430 | + */ |
| 431 | +$messages['he'] = array( |
| 432 | + 'livetranslate-desc' => 'הפעלת תרגום חי של תוכן הדף באמצעות שירות התרגום של גוגל', |
| 433 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|לשנות]] את רשימת זיכרונות התרגום', |
| 434 | + 'livetranslate-translate-to' => 'לתרגם דף זה ל', |
| 435 | + 'livetranslate-button-translate' => 'תרגום', |
| 436 | + 'livetranslate-button-translating' => 'מתבצע תרגום...', |
| 437 | + 'livetranslate-button-revert' => 'הצגת המקור', |
| 438 | + 'livetranslate-dictionary-error' => 'לא ניתן להשיג את מילון התרגום החי. מילים לא יטופלו כמיוחדות במהלך התרגום.', |
| 439 | + 'livetranslate-dictionary-empty' => 'במילון עדיין אין מילים. להוספה יש ללחות על "עריכה".', |
| 440 | + 'livetranslate-dictionary-count' => 'יש {{PLURAL:$1|מילה אחת|$1 מילים}} ב־{{PLURAL:$2|שפה אחת|$2 שפות}}. להוספה יש ללחוץ על "עריכה".', |
| 441 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|השפה הזאת אינה מוגדרת|השפות האלה אינן מוגדרות}} כעת כיעד לתרגום: $1. שנו השפות המאופשרות בהגדרות הוויקי שלכם או הוציאו אותן מהמילון.', |
| 442 | + 'livetranslate-dictionary-goto-edit' => 'שינוי זיכרונות תרגום.', |
| 443 | + 'special-livetranslate' => 'תרגום חי', |
| 444 | + 'livetranslate-tmtype-ltf' => 'תסדיר תרגום חי', |
| 445 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 446 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 447 | + 'livetranslate-special-no-tms-yet' => 'אין עדיין שום זיכרונות תרגום.', |
| 448 | + 'livetranslate-special-button' => 'שמירה ועדכון', |
| 449 | + 'livetranslate-special-type' => 'סוג', |
| 450 | + 'livetranslate-special-location' => 'מיקום', |
| 451 | + 'livetranslate-special-remove' => 'הסרה', |
| 452 | + 'livetranslate-special-local' => 'מקומי', |
| 453 | + 'livetranslate-special-add-tm' => 'הוסף זיכרון תרגום חדש', |
| 454 | + 'livetranslate-special-current-tms' => 'זיכרונות תרגום קיימים', |
| 455 | + 'livetranslate-special-tms-update' => 'עדכון זיכרונות תרגום', |
| 456 | + 'livetranslate-special-update' => 'עדכון זיכרונות תרגום', |
| 457 | + 'livetranslate-importtms-param-miscmatch' => 'מתאים בין מספר המיקומים למספר הסוגים', |
| 458 | +); |
| 459 | + |
| 460 | +/** Upper Sorbian (Hornjoserbsce) |
| 461 | + * @author Michawiki |
| 462 | + */ |
| 463 | +$messages['hsb'] = array( |
| 464 | + 'livetranslate-desc' => 'Zmóžnja hnydomne přełožowanje wobsaha strony z pomocu słužby "Google Translate"', |
| 465 | + 'livetranslate-translate-to' => 'Přełož tutu stronu do', |
| 466 | + 'livetranslate-button-translate' => 'Přełožić', |
| 467 | + 'livetranslate-button-translating' => 'Přełožuje so...', |
| 468 | + 'livetranslate-button-revert' => 'Original pokazać', |
| 469 | + 'livetranslate-dictionary-error' => 'Słownik za Live Translate njeda so začitać. Jeho słowa so za přełožowanski proces njewobkedźbuja.', |
| 470 | + 'livetranslate-dictionary-empty' => 'Hišće žane słowa w słowniku njejsu. Klikń na rajtark "wobdźěłać", zo by někotre přidał.', |
| 471 | + '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ł.', |
| 472 | + '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.', |
| 473 | + 'livetranslate-dictionary-goto-edit' => 'Pśełožowański składowak změniś.', |
| 474 | + 'special-livetranslate' => 'Live translate', |
| 475 | + 'livetranslate-tmtype-ltf' => 'Live Translate format', |
| 476 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 477 | + 'livetranslate-tmtype-gcsv' => 'Google-CSV', |
| 478 | + 'livetranslate-special-no-tms-yet' => 'Hišće přełožkowe składowaki njejsu.', |
| 479 | + 'livetranslate-special-button' => 'Składować a aktualizować', |
| 480 | + 'livetranslate-special-type' => 'Typ', |
| 481 | + 'livetranslate-special-location' => 'Městno', |
| 482 | + 'livetranslate-special-remove' => 'Wotstronić', |
| 483 | + 'livetranslate-special-local' => 'Lokalny', |
| 484 | + 'livetranslate-special-add-tm' => 'Nowy přełožkowy składowak přidać', |
| 485 | + 'livetranslate-special-current-tms' => 'Eksistowace přełožkowe składowaki', |
| 486 | + 'livetranslate-special-tms-update' => 'Přełožkowe składowaki aktualizować', |
| 487 | + 'livetranslate-special-update' => 'Přełožkowe składowaki aktualizować', |
| 488 | + 'livetranslate-importtms-param-miscmatch' => 'Njepoměr mjez ličbu městnow a typow', |
| 489 | +); |
| 490 | + |
| 491 | +/** Interlingua (Interlingua) |
| 492 | + * @author McDutchie |
| 493 | + */ |
| 494 | +$messages['ia'] = array( |
| 495 | + 'livetranslate-desc' => 'Permitte le traduction in directo de contento de paginas usante le servicio Google Translate', |
| 496 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modificar]] le lista de memorias de traduction', |
| 497 | + 'livetranslate-translate-to' => 'Traducer iste pagina in', |
| 498 | + 'livetranslate-button-translate' => 'Traducer', |
| 499 | + 'livetranslate-button-translating' => 'Traduction in curso...', |
| 500 | + 'livetranslate-button-revert' => 'Monstrar original', |
| 501 | + 'livetranslate-dictionary-error' => 'Non poteva obtener le dictionario de traduction in directo. Nulle parola essera tractate como special durante le processo de traduction.', |
| 502 | + 'livetranslate-dictionary-empty' => 'Le dictionario non ha ancora parolas. Clicca sur le scheda "modificar" pro adder alcunes.', |
| 503 | + '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.', |
| 504 | + '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.', |
| 505 | + 'livetranslate-dictionary-goto-edit' => 'Modificar le memorias de traduction.', |
| 506 | + 'special-livetranslate' => 'Traduction in directo', |
| 507 | + 'livetranslate-tmtype-ltf' => 'Formato de traduction in directo', |
| 508 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 509 | + 'livetranslate-tmtype-gcsv' => 'CSV de Google', |
| 510 | + 'livetranslate-special-no-tms-yet' => 'Il non ha ancora memorias de traduction.', |
| 511 | + 'livetranslate-special-button' => 'Salveguardar e actualisar', |
| 512 | + 'livetranslate-special-type' => 'Typo', |
| 513 | + 'livetranslate-special-location' => 'Loco', |
| 514 | + 'livetranslate-special-remove' => 'Remover', |
| 515 | + 'livetranslate-special-local' => 'Local', |
| 516 | + 'livetranslate-special-add-tm' => 'Adder un nove memoria de traduction', |
| 517 | + 'livetranslate-special-current-tms' => 'Memorias de traduction existente', |
| 518 | + 'livetranslate-special-tms-update' => 'Actualisar memorias de traduction', |
| 519 | + 'livetranslate-special-update' => 'Actualisar memorias de traduction', |
| 520 | + 'livetranslate-importtms-param-miscmatch' => 'Le numero de locos differe del numero de typos', |
| 521 | +); |
| 522 | + |
| 523 | +/** Indonesian (Bahasa Indonesia) |
| 524 | + * @author IvanLanin |
| 525 | + */ |
| 526 | +$messages['id'] = array( |
| 527 | + 'livetranslate-desc' => 'Memungkinkan penerjemahan langsung konten halaman dengan menggunakan layanan Google Terjemahan', |
| 528 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Mengubah]] daftar memori terjemahan', |
| 529 | + 'livetranslate-translate-to' => 'Terjemahkan halaman ini ke', |
| 530 | + 'livetranslate-button-translate' => 'Terjemahkan', |
| 531 | + 'livetranslate-button-translating' => 'Menerjemahkan ...', |
| 532 | + 'livetranslate-button-revert' => 'Tampilkan yang asli', |
| 533 | + 'livetranslate-dictionary-error' => 'Tidak dapat memperoleh kamus penerjemahan langsung. Tidak ada kata yang diperlakukan secara khusus selama proses penerjemahan.', |
| 534 | + 'livetranslate-dictionary-empty' => 'Belum tersedia kata dalam kamus. Klik tab "sunting" untuk menambahkan.', |
| 535 | + 'livetranslate-dictionary-count' => 'Ada {{PLURAL:$1|$1 kata|$1 kata}} dalam $2 {{PLURAL:$2|bahasa|bahasa}}. Klik tab "sunting" untuk menambakan.', |
| 536 | + '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.', |
| 537 | + 'livetranslate-dictionary-goto-edit' => 'Modifikasi memori terjemahan.', |
| 538 | + 'special-livetranslate' => 'Terjemahan langsung', |
| 539 | + 'livetranslate-tmtype-ltf' => 'Format Terjemahan Langsung', |
| 540 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 541 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 542 | + 'livetranslate-special-no-tms-yet' => 'Memori terjemahan belum tersedia.', |
| 543 | + 'livetranslate-special-button' => 'Simpan dan perbarui', |
| 544 | + 'livetranslate-special-type' => 'Jenis', |
| 545 | + 'livetranslate-special-location' => 'Lokasi', |
| 546 | + 'livetranslate-special-remove' => 'Hapus', |
| 547 | + 'livetranslate-special-local' => 'Lokal', |
| 548 | + 'livetranslate-special-add-tm' => 'Tambahkan memori terjemahan baru', |
| 549 | + 'livetranslate-special-current-tms' => 'Memori terjemahan yang ada', |
| 550 | + 'livetranslate-special-tms-update' => 'Perbarui memori terjemahan', |
| 551 | + 'livetranslate-special-update' => 'Perbarui memori terjemahan', |
| 552 | + 'livetranslate-importtms-param-miscmatch' => 'Jumlah lokasi dan jenis tidak sesuai', |
| 553 | +); |
| 554 | + |
| 555 | +/** Italian (Italiano) |
| 556 | + * @author Beta16 |
| 557 | + */ |
| 558 | +$messages['it'] = array( |
| 559 | + 'livetranslate-button-translate' => 'Traduci', |
| 560 | + 'livetranslate-button-translating' => 'Traduzione in corso...', |
| 561 | +); |
| 562 | + |
| 563 | +/** Japanese (日本語) |
| 564 | + * @author Ohgi |
| 565 | + */ |
| 566 | +$messages['ja'] = array( |
| 567 | + 'livetranslate-translate-to' => 'このページを翻訳', |
| 568 | + 'livetranslate-button-translate' => '翻訳', |
| 569 | + 'livetranslate-button-translating' => '翻訳中...', |
| 570 | +); |
| 571 | + |
| 572 | +/** Colognian (Ripoarisch) |
| 573 | + * @author Purodha |
| 574 | + */ |
| 575 | +$messages['ksh'] = array( |
| 576 | + 'livetranslate-desc' => 'Määt en „{{int:special-livetranslate}}“ müjjelesch met <span class="plainlinks">[http://translate.google.com/ Google Translate]</span>.', |
| 577 | + 'livetranslate-translate-to' => 'Donn di Sigg heh op ', |
| 578 | + 'livetranslate-button-translate' => 'Övversätze!', |
| 579 | + 'livetranslate-button-translating' => 'Am Övversätze …', |
| 580 | + 'livetranslate-button-revert' => 'Ojinaal Shprooch aanzeije', |
| 581 | + 'livetranslate-dictionary-error' => 'Mer kunnte kein Wööterbooch fenge. Kei Woot weet beim Övversäze extra behandelt.', |
| 582 | + 'livetranslate-dictionary-empty' => 'Mer han noch kei Woot em Wööterbooch. |
| 583 | +Övver dä „{{int:edit}}“-Lengk kam_mer Wööter enjävve.', |
| 584 | + 'livetranslate-dictionary-count' => 'Mer han {{PLURAL:$1|ei Woot|$1 Wööter|kei Woot}} en $2 {{PLURAL:$2|Shprooch|Shprooche|Shprooche}} em Wööterbooch. Övver dä Lenk „{{int:Edit}}“ kam_mer noch mieh enjävve.', |
| 585 | + 'livetranslate-dictionary-unallowed-langs' => 'Di {{PLURAL:$2|Shprooch es|Shprooche sin|X}} em Momang nit zohjelohße för et Övversäze: $1. Donn jäz de zohjelohße Shprooche em Wiki ändere udder heh di {{PLURAL:$2|Shprooch|Shprooche|X}} uss_em Wööterbooch schmieße.', |
| 586 | + 'livetranslate-dictionary-goto-edit' => 'De Speicher för Övversäzunge ändere.', |
| 587 | + 'special-livetranslate' => 'Lebändesch Övversäze', |
| 588 | + 'livetranslate-tmtype-ltf' => '<i lang="en">Live-Translate</i>-Format', |
| 589 | + 'livetranslate-tmtype-tmx' => '<i lang="en">Translation Memory eXchange</i>', |
| 590 | + 'livetranslate-tmtype-gcsv' => '<i lang="en">Google-CSV</i>', |
| 591 | + 'livetranslate-special-no-tms-yet' => 'Mer han noch kein Speicher för Övversäzunge.', |
| 592 | + 'livetranslate-special-button' => 'Faßhallde un op ene neue Stand bränge', |
| 593 | + 'livetranslate-special-type' => 'Zoot', |
| 594 | + 'livetranslate-special-location' => 'Woh?', |
| 595 | + 'livetranslate-special-remove' => 'Nemm fott!', |
| 596 | + 'livetranslate-special-local' => 'Heh', |
| 597 | + 'livetranslate-special-add-tm' => 'Ene neue Speicher för Övversäzunge dobei donn', |
| 598 | + 'livetranslate-special-current-tms' => 'Speicher för Övversäzunge, di ald doh sin', |
| 599 | + 'livetranslate-special-tms-update' => 'Speicher för Övversäzunge op ene neue Stand bränge', |
| 600 | + 'livetranslate-special-update' => 'Speicher för Övversäzunge op ene neue Stand bränge', |
| 601 | + 'livetranslate-importtms-param-miscmatch' => 'De Aanzahl Speicherplätz un Zoote paß nit zosamme.', |
| 602 | +); |
| 603 | + |
| 604 | +/** Kurdish (Latin) (Kurdî (Latin)) |
| 605 | + * @author George Animal |
| 606 | + */ |
| 607 | +$messages['ku-latn'] = array( |
| 608 | + 'livetranslate-special-type' => 'Cure', |
| 609 | +); |
| 610 | + |
| 611 | +/** Luxembourgish (Lëtzebuergesch) |
| 612 | + * @author Robby |
| 613 | + */ |
| 614 | +$messages['lb'] = array( |
| 615 | + 'livetranslate-desc' => 'Erméiglecht d\'live Iwwersetzen vu Säiteninhalt mam Service "Google Translate"', |
| 616 | + 'right-managetms' => "[[Special:SpecialLiveTranslate|Ännert]] d'Lëscht vun Iwwersetzungen am Späicher", |
| 617 | + 'livetranslate-translate-to' => 'Iwwersetzt dës Säit op', |
| 618 | + 'livetranslate-button-translate' => 'Iwwersetzen', |
| 619 | + 'livetranslate-button-translating' => 'Iwwersetzen...', |
| 620 | + 'livetranslate-button-revert' => "D'Original weisen", |
| 621 | + 'livetranslate-dictionary-error' => 'De Live-Iwwersetzungs-Dictionnaire gouf net fonnt. Keng Wierder gi bei der Iwwersetzung als spezial ugekuckt.', |
| 622 | + 'livetranslate-dictionary-empty' => 'Et gëtt nach keng Wierder am Dictionnaire. Klickt op den "Änneren"-Tab fir der derbäizesetzen.', |
| 623 | + '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.', |
| 624 | + '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.", |
| 625 | + 'livetranslate-dictionary-goto-edit' => 'Den Iwwersetzungsspäicher änneren.', |
| 626 | + 'special-livetranslate' => 'Live iwwersetzen', |
| 627 | + 'livetranslate-tmtype-ltf' => 'Live Translate Format', |
| 628 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 629 | + 'livetranslate-tmtype-gcsv' => 'Google-CSV', |
| 630 | + 'livetranslate-special-no-tms-yet' => 'Et gëtt elo nach keen Iwwersetzungsspäicher.', |
| 631 | + 'livetranslate-special-button' => 'Späicheren an aktualiséieren', |
| 632 | + 'livetranslate-special-type' => 'Typ', |
| 633 | + 'livetranslate-special-location' => 'Plaz', |
| 634 | + 'livetranslate-special-remove' => 'Ewechhuelen', |
| 635 | + 'livetranslate-special-local' => 'Lokal', |
| 636 | + 'livetranslate-special-add-tm' => 'En neien Iwwersetzungsspäicher derbäisetzen', |
| 637 | + 'livetranslate-special-current-tms' => 'Aktuell Iwwersetzungsspäicheren', |
| 638 | + 'livetranslate-special-tms-update' => 'Den Iwwersetzungsspäicher aktualiséieren.', |
| 639 | + 'livetranslate-special-update' => 'Den Iwwersetzungsspäicher aktualiséieren.', |
| 640 | + 'livetranslate-importtms-param-miscmatch' => 'Duercherneen tëschent der Zuel vu Plazen an Typen', |
| 641 | +); |
| 642 | + |
| 643 | +/** Macedonian (Македонски) |
| 644 | + * @author Bjankuloski06 |
| 645 | + */ |
| 646 | +$messages['mk'] = array( |
| 647 | + 'livetranslate-desc' => 'Овозможува преведување на содржината на една страница во живо, користејќи Google Translate', |
| 648 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Менување]] на списокот на преводни памтила', |
| 649 | + 'livetranslate-translate-to' => 'Преведи ја страницава на', |
| 650 | + 'livetranslate-button-translate' => 'Преведи', |
| 651 | + 'livetranslate-button-translating' => 'Преведувам...', |
| 652 | + 'livetranslate-button-revert' => 'Прикажи изворно', |
| 653 | + 'livetranslate-dictionary-error' => 'Не можев да го добијам речникот за преведување во живо. Ниеден збор нема да се смета за посебен во текот на преводната постапка.', |
| 654 | + 'livetranslate-dictionary-empty' => 'Сè уште нема зборови во речникот. Стиснете на јазичето „уреди“ и додајте некои.', |
| 655 | + 'livetranslate-dictionary-count' => 'Има {{PLURAL:$1|$1 збор|$1 збора}} на $2 {{PLURAL:$2|јазик|јазици}}. Ситиснете на јазичето „уреди“ за да додадете уште.', |
| 656 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Овој јазик моментално не е зададен|Овие јазици моментално не се зададени}} како допуштена преводна одредница: $1. Изменете ги допуштените јазици во вики-поставките, или пак отстранете ги постоечкиве од речникот.', |
| 657 | + 'livetranslate-dictionary-goto-edit' => 'Измени ги преводните памтила.', |
| 658 | + 'special-livetranslate' => 'Преведување во живо', |
| 659 | + 'livetranslate-tmtype-ltf' => 'Формат на преведувањето во живо', |
| 660 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 661 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 662 | + 'livetranslate-special-no-tms-yet' => 'Сè уште нема преводни памтила', |
| 663 | + 'livetranslate-special-button' => 'Зачувај и поднови', |
| 664 | + 'livetranslate-special-type' => 'Тип', |
| 665 | + 'livetranslate-special-location' => 'Место', |
| 666 | + 'livetranslate-special-remove' => 'Отстрани', |
| 667 | + 'livetranslate-special-local' => 'Локално', |
| 668 | + 'livetranslate-special-add-tm' => 'Додај ново преводно памтило', |
| 669 | + 'livetranslate-special-current-tms' => 'Постоечки преводни памтила', |
| 670 | + 'livetranslate-special-tms-update' => 'Поднови преводни памтила', |
| 671 | + 'livetranslate-special-update' => 'Поднови преводни памтила', |
| 672 | + 'livetranslate-importtms-param-miscmatch' => 'Бројот на местата и бројот на типовите не се совпаѓаат', |
| 673 | +); |
| 674 | + |
| 675 | +/** Malay (Bahasa Melayu) |
| 676 | + * @author Anakmalaysia |
| 677 | + */ |
| 678 | +$messages['ms'] = array( |
| 679 | + 'livetranslate-special-location' => 'Lokasi', |
| 680 | + 'livetranslate-special-remove' => 'Buang', |
| 681 | +); |
| 682 | + |
| 683 | +/** Dutch (Nederlands) |
| 684 | + * @author McDutchie |
| 685 | + * @author SPQRobin |
| 686 | + * @author Siebrand |
| 687 | + */ |
| 688 | +$messages['nl'] = array( |
| 689 | + 'livetranslate-desc' => 'Maakt het mogelijk paginainhoud live te vertalen met behulp van de dienst Google Translate', |
| 690 | + 'right-managetms' => 'De lijst met vertaalgeheugens [[Special:SpecialLiveTranslate|wijzigen]]', |
| 691 | + 'livetranslate-translate-to' => 'Pagina vertalen in het', |
| 692 | + 'livetranslate-button-translate' => 'Vertalen', |
| 693 | + 'livetranslate-button-translating' => 'Bezig met vertalen...', |
| 694 | + 'livetranslate-button-revert' => 'Origineel weergeven', |
| 695 | + '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.', |
| 696 | + 'livetranslate-dictionary-empty' => 'Er zijn nog geen woorden in het woordenboek. Klik op de tab "bewerken" om woorden toe te voegen.', |
| 697 | + '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.', |
| 698 | + '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.', |
| 699 | + 'livetranslate-dictionary-goto-edit' => 'Vertaalgeheugens wijzigen.', |
| 700 | + 'special-livetranslate' => 'Live vertalen', |
| 701 | + 'livetranslate-tmtype-ltf' => 'Live Vertalen-opmaak', |
| 702 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 703 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 704 | + 'livetranslate-special-no-tms-yet' => 'Er zijn nog geen vertaalgeheugens.', |
| 705 | + 'livetranslate-special-button' => 'Opslaan en bijwerken', |
| 706 | + 'livetranslate-special-type' => 'Type', |
| 707 | + 'livetranslate-special-location' => 'Locatie', |
| 708 | + 'livetranslate-special-remove' => 'Verwijderen', |
| 709 | + 'livetranslate-special-local' => 'Lokaal', |
| 710 | + 'livetranslate-special-add-tm' => 'Nieuw vertaalgeheugen toevoegen', |
| 711 | + 'livetranslate-special-current-tms' => 'Bestaande vertaalgeheugens', |
| 712 | + 'livetranslate-special-tms-update' => 'Vertaalgeheugens bijwerken', |
| 713 | + 'livetranslate-special-update' => 'Vertaalgeheugens bijwerken', |
| 714 | + 'livetranslate-importtms-param-miscmatch' => 'Er is een verschil tussen het aantal locaties en typen', |
| 715 | +); |
| 716 | + |
| 717 | +/** Norwegian (bokmål) (Norsk (bokmål)) |
| 718 | + * @author Nghtwlkr |
| 719 | + */ |
| 720 | +$messages['no'] = array( |
| 721 | + 'livetranslate-desc' => 'Aktiverer live-oversettelse av sideinnhold ved hjelp av tjenesten Google Translate', |
| 722 | + 'livetranslate-translate-to' => 'Oversett denne siden til', |
| 723 | + 'livetranslate-button-translate' => 'Oversett', |
| 724 | + 'livetranslate-button-translating' => 'Oversetter...', |
| 725 | + 'livetranslate-button-revert' => 'Vis opprinnelig', |
| 726 | + 'livetranslate-dictionary-error' => 'Kunne ikke få tak i sanntidsoversettelsesordlisten. Ingen ord vil bli behandlet som spesielle under oversettelsesprosessen.', |
| 727 | + 'livetranslate-dictionary-empty' => 'Det er ingen ord i ordlisten ennå. Klikk på «rediger»-fanen for å legge til noen.', |
| 728 | + '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.', |
| 729 | + '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.', |
| 730 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 731 | + 'livetranslate-special-button' => 'Lagre og oppdater', |
| 732 | + 'livetranslate-special-type' => 'Type', |
| 733 | + 'livetranslate-special-location' => 'Plassering', |
| 734 | + 'livetranslate-special-remove' => 'Fjern', |
| 735 | + 'livetranslate-special-local' => 'Lokal', |
| 736 | + 'livetranslate-special-add-tm' => 'Legg til et nytt oversettelsesminne', |
| 737 | + 'livetranslate-special-current-tms' => 'Eksisterende oversettelsesminner', |
| 738 | + 'livetranslate-special-tms-update' => 'Oppdater oversettelsesminner', |
| 739 | + 'livetranslate-special-update' => 'Oppdater oversettelsesminner', |
| 740 | + 'livetranslate-importtms-param-miscmatch' => 'Avvik mellom antall plasseringer og typer', |
| 741 | +); |
| 742 | + |
| 743 | +/** Polish (Polski) |
| 744 | + * @author Byulent |
| 745 | + * @author Sp5uhe |
| 746 | + */ |
| 747 | +$messages['pl'] = array( |
| 748 | + 'livetranslate-desc' => 'Włącza tłumaczenie zawartości strony na żywo z wykorzystaniem serwisu tłumaczącego Google', |
| 749 | + 'livetranslate-translate-to' => 'Przetłumacz tę stronę na', |
| 750 | + 'livetranslate-button-translate' => 'Tłumacz', |
| 751 | + 'livetranslate-button-translating' => 'Tłumaczenie...', |
| 752 | + 'livetranslate-button-revert' => 'Pokaż w oryginale', |
| 753 | + '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.', |
| 754 | + 'livetranslate-dictionary-empty' => 'Na razie brak jest jeszcze słów w słowniku. Kliknij zakładkę „Edytuj“ aby jakieś dodać.', |
| 755 | + '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.', |
| 756 | + '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.', |
| 757 | +); |
| 758 | + |
| 759 | +/** Piedmontese (Piemontèis) |
| 760 | + * @author Borichèt |
| 761 | + * @author Dragonòt |
| 762 | + */ |
| 763 | +$messages['pms'] = array( |
| 764 | + 'livetranslate-desc' => 'A abìlita la tradussion imedià dël contnù ëd la pàgina an dovrand ël sërvissi ëd tradussion ëd Google', |
| 765 | + 'livetranslate-translate-to' => 'Vòlta sta pàgina an', |
| 766 | + 'livetranslate-button-translate' => 'Traduv', |
| 767 | + 'livetranslate-button-translating' => 'Volté...', |
| 768 | + 'livetranslate-button-revert' => "Mostré l'original", |
| 769 | + 'livetranslate-dictionary-error' => 'As peul pa avèisse la tradussion imedià dël dissionari. Gnun-e paròle a saran tratà com speciaj durant ël process ëd tradussion.', |
| 770 | + 'livetranslate-dictionary-empty' => 'A-i é pa anco\' gnun-e paròle ant ël dissionari. Sgnaca ël boton "modìfica" për giuntene quaidun-e.', |
| 771 | + '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.', |
| 772 | + 'livetranslate-dictionary-unallowed-langs' => "{{PLURAL:$2|Costa lenga a l'é|Coste lenghe a son}} al moment pa ampostà com obietiv përmëttù ed tradussion: $1. Ch'a modìfica le lenghe përmëttùe ant soa configurassion ëd wiki, o ch'a-j gava dal dissionari.", |
| 773 | + 'livetranslate-dictionary-goto-edit' => 'Modìfica le memòrie ëd viragi.', |
| 774 | + 'special-livetranslate' => 'Viragi dal viv', |
| 775 | + 'livetranslate-tmtype-ltf' => 'Formà ëd Live Translate', |
| 776 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 777 | + 'livetranslate-tmtype-gcsv' => 'CSV ëd Google', |
| 778 | + 'livetranslate-special-no-tms-yet' => "A-i é pa anco' memòrie ëd viragi.", |
| 779 | + 'livetranslate-special-button' => 'Salva e modìfica', |
| 780 | + 'livetranslate-special-type' => 'Sòrt', |
| 781 | + 'livetranslate-special-location' => 'Locassion', |
| 782 | + 'livetranslate-special-remove' => 'Gava', |
| 783 | + 'livetranslate-special-local' => 'Local', |
| 784 | + 'livetranslate-special-add-tm' => 'Gionta na memòria ëd viragi neuva', |
| 785 | + 'livetranslate-special-current-tms' => 'Memòrie ëd viragi esistente', |
| 786 | + 'livetranslate-special-tms-update' => 'Modìfica memòrie ëd viragi', |
| 787 | + 'livetranslate-special-update' => 'Modìfica memòrie ëd viragi', |
| 788 | + 'livetranslate-importtms-param-miscmatch' => 'Dëscordansa tra total dle locassion e sòrt', |
| 789 | +); |
| 790 | + |
| 791 | +/** Pashto (پښتو) |
| 792 | + * @author Ahmed-Najib-Biabani-Ibrahimkhel |
| 793 | + */ |
| 794 | +$messages['ps'] = array( |
| 795 | + 'livetranslate-button-translate' => 'ژباړل', |
| 796 | + 'livetranslate-button-translating' => 'د ژباړې په حال کې...', |
| 797 | + 'livetranslate-special-location' => 'ځای', |
| 798 | + 'livetranslate-special-local' => 'سيمه ايز', |
| 799 | +); |
| 800 | + |
| 801 | +/** Portuguese (Português) |
| 802 | + * @author Hamilton Abreu |
| 803 | + */ |
| 804 | +$messages['pt'] = array( |
| 805 | + 'livetranslate-desc' => 'Permite a tradução imediata do conteúdo das páginas usando o serviço Google Translate', |
| 806 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modificar]] a lista de memórias de tradução', |
| 807 | + 'livetranslate-translate-to' => 'Traduzir esta página para', |
| 808 | + 'livetranslate-button-translate' => 'Traduzir', |
| 809 | + 'livetranslate-button-translating' => 'A traduzir...', |
| 810 | + 'livetranslate-button-revert' => 'Mostrar original', |
| 811 | + '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.', |
| 812 | + 'livetranslate-dictionary-empty' => 'Ainda não existem palavras no dicionário. Clique o separador "editar" para adicionar algumas.', |
| 813 | + '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.', |
| 814 | + '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.', |
| 815 | + 'livetranslate-dictionary-goto-edit' => 'Modificar as memórias de tradução.', |
| 816 | + 'special-livetranslate' => 'Tradução ao vivo', |
| 817 | + 'livetranslate-tmtype-ltf' => 'Formato de Tradução ao Vivo', |
| 818 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 819 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 820 | + 'livetranslate-special-no-tms-yet' => 'Ainda não há nenhuma memória de tradução.', |
| 821 | + 'livetranslate-special-button' => 'Gravar e actualizar', |
| 822 | + 'livetranslate-special-type' => 'Tipo', |
| 823 | + 'livetranslate-special-location' => 'Localização', |
| 824 | + 'livetranslate-special-remove' => 'Remover', |
| 825 | + 'livetranslate-special-local' => 'Local', |
| 826 | + 'livetranslate-special-add-tm' => 'Adicionar uma memória de tradução nova', |
| 827 | + 'livetranslate-special-current-tms' => 'Memórias de tradução existentes', |
| 828 | + 'livetranslate-special-tms-update' => 'Actualizar memórias de tradução', |
| 829 | + 'livetranslate-special-update' => 'Actualizar memórias de tradução', |
| 830 | + 'livetranslate-importtms-param-miscmatch' => 'Discordância entre a quantidade de locais e tipos', |
| 831 | +); |
| 832 | + |
| 833 | +/** Brazilian Portuguese (Português do Brasil) |
| 834 | + * @author Giro720 |
| 835 | + */ |
| 836 | +$messages['pt-br'] = array( |
| 837 | + 'livetranslate-desc' => 'Permite a tradução imediata do conteúdo das páginas usando o serviço Google Translate', |
| 838 | + 'livetranslate-translate-to' => 'Traduzir esta página para', |
| 839 | + 'livetranslate-button-translate' => 'Traduzir', |
| 840 | + 'livetranslate-button-translating' => 'Traduzindo...', |
| 841 | +); |
| 842 | + |
| 843 | +/** Russian (Русский) |
| 844 | + * @author Byulent |
| 845 | + * @author MaxSem |
| 846 | + * @author Александр Сигачёв |
| 847 | + */ |
| 848 | +$messages['ru'] = array( |
| 849 | + 'livetranslate-desc' => 'Включает перевод текста страницы на лету с помощью службы переводов Google', |
| 850 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|изменять]] список памяти переводов', |
| 851 | + 'livetranslate-translate-to' => 'Перевести эту страницу на', |
| 852 | + 'livetranslate-button-translate' => 'Перевести', |
| 853 | + 'livetranslate-button-translating' => 'Выполняется перевод...', |
| 854 | + 'livetranslate-button-revert' => 'Показать оригинал', |
| 855 | + 'livetranslate-dictionary-error' => 'Не удалось получить словарь живого перевода. Нет слов, которые будут рассматриваться как специальные во время процесса перевода.', |
| 856 | + 'livetranslate-dictionary-empty' => 'В словаре ещё нет слов. Нажмите «править», чтобы добавить несколько.', |
| 857 | + 'livetranslate-dictionary-count' => '$1 {{PLURAL:$1|слово|слова|слов}} на $2 {{PLURAL:$2|языке|языках|языках}}. Нажмите «править», чтобы добавить ещё.', |
| 858 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Этот язык|Эти языки}} не разрешено использовать в качестве цели перевода: $1. Измените разрешения в настройках вашей вики, или удалите их из словаря.', |
| 859 | + 'livetranslate-dictionary-goto-edit' => 'Изменение памяти переводов.', |
| 860 | + 'special-livetranslate' => 'Перевод на лету', |
| 861 | + 'livetranslate-tmtype-ltf' => 'Формат перевода на лету', |
| 862 | + 'livetranslate-tmtype-tmx' => 'Обмен памятью перевода', |
| 863 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 864 | + 'livetranslate-special-no-tms-yet' => 'Памяти переводов пока нет.', |
| 865 | + 'livetranslate-special-button' => 'Сохранить и обновить', |
| 866 | + 'livetranslate-special-type' => 'Тип', |
| 867 | + 'livetranslate-special-location' => 'Расположение', |
| 868 | + 'livetranslate-special-remove' => 'Удалить', |
| 869 | + 'livetranslate-special-local' => 'Местное', |
| 870 | + 'livetranslate-special-add-tm' => 'Добавить новую память переводов', |
| 871 | + 'livetranslate-special-current-tms' => 'Существующие памяти переводов', |
| 872 | + 'livetranslate-special-tms-update' => 'Обновление памяти переводов', |
| 873 | + 'livetranslate-special-update' => 'Обновление памяти переводов', |
| 874 | + 'livetranslate-importtms-param-miscmatch' => 'Несоответствие количества расположений и типов', |
| 875 | +); |
| 876 | + |
| 877 | +/** Swedish (Svenska) |
| 878 | + * @author WikiPhoenix |
| 879 | + */ |
| 880 | +$messages['sv'] = array( |
| 881 | + 'livetranslate-translate-to' => 'Översätt den här sidan till', |
| 882 | + 'livetranslate-button-translate' => 'Översätt', |
| 883 | + 'livetranslate-button-translating' => 'Översätter...', |
| 884 | + 'livetranslate-button-revert' => 'Visa originaltexten', |
| 885 | + 'livetranslate-dictionary-empty' => 'Det finns inga ord i ordboken ännu. Klicka på fliken "redigera" för att lägga till.', |
| 886 | + 'livetranslate-dictionary-count' => 'Det finns {{PLURAL:$1|$1 ord|$1 ord}} i $2 {{PLURAL:$2|språk|olika språk}}. Klicka på fliken "redigera" för att lägga till mer.', |
| 887 | + 'livetranslate-dictionary-goto-edit' => 'Ändra översättningsminnena.', |
| 888 | + 'livetranslate-special-no-tms-yet' => 'Det finns inga översättningsminnen ännu.', |
| 889 | + 'livetranslate-special-button' => 'Spara och uppdatera', |
| 890 | + 'livetranslate-special-type' => 'Typ', |
| 891 | + 'livetranslate-special-location' => 'Plats', |
| 892 | + 'livetranslate-special-remove' => 'Ta bort', |
| 893 | + 'livetranslate-special-local' => 'Lokal', |
| 894 | + 'livetranslate-special-add-tm' => 'Lägg till ett nytt översättningsminne', |
| 895 | + 'livetranslate-special-tms-update' => 'Uppdatera översättningsminnen', |
| 896 | + 'livetranslate-special-update' => 'Uppdatera översättningsminnen', |
| 897 | +); |
| 898 | + |
| 899 | +/** Telugu (తెలుగు) |
| 900 | + * @author Veeven |
| 901 | + */ |
| 902 | +$messages['te'] = array( |
| 903 | + 'livetranslate-translate-to' => 'ఈ పుటని అనువదించండి', |
| 904 | + 'livetranslate-button-translate' => 'అనువదించు', |
| 905 | + 'livetranslate-button-translating' => 'అనువదిస్తున్నాం...', |
| 906 | + 'livetranslate-special-type' => 'రకం', |
| 907 | + 'livetranslate-special-location' => 'ప్రాంతం', |
| 908 | +); |
| 909 | + |
| 910 | +/** Tetum (Tetun) |
| 911 | + * @author MF-Warburg |
| 912 | + */ |
| 913 | +$messages['tet'] = array( |
| 914 | + 'livetranslate-special-remove' => 'Hasai', |
| 915 | +); |
| 916 | + |
| 917 | +/** Tagalog (Tagalog) |
| 918 | + * @author AnakngAraw |
| 919 | + */ |
| 920 | +$messages['tl'] = array( |
| 921 | + 'livetranslate-desc' => 'Nagpapagana ng buhay na pagsasalinwika ng nilalaman ng pahina na ginagamit ang palingkurang Google Translate', |
| 922 | + 'livetranslate-translate-to' => 'Isalinwika ang pahinang ito upang maging', |
| 923 | + 'livetranslate-button-translate' => 'Isalinwika', |
| 924 | + 'livetranslate-button-translating' => 'Isinasalinwika...', |
| 925 | + 'livetranslate-button-revert' => 'Ipakita ang orihinal', |
| 926 | + 'livetranslate-dictionary-error' => 'Hindi makamtan ang talahuluganan ng buhay na pagsasalinwika. Walang mga salitang ituturing na natatangi habang isinasagawa ang pagsasalinwika.', |
| 927 | + 'livetranslate-dictionary-empty' => 'Walang mga salita sa loob ng talahuluganan. Pindutin ang laylayan na "baguhin" upang makapagdagdag ng ilan.', |
| 928 | + 'livetranslate-dictionary-count' => 'May {{PLURAL:$1|$1 salita|$1 mga salita}} na nasa $2 {{PLURAL:$2|wika|mga wika}}. Pindutin ang laylay na "baguhin" upang magdagdag pa.', |
| 929 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Ang wikang ito ay|Ang mga wikang ito ay}} pangkasalukuyang hindi nakatakda bilang pinapahintulutang pinupukol na salinwika: $1. Baguhin ang pinapayagang mga wika sa loob ng iyong pagkakaayos ng mga wiki, o tanggalin ang mga ito mula sa talahulugan.', |
| 930 | + 'livetranslate-dictionary-goto-edit' => 'Baguhin ang mga alaala ng pagsasalinwika.', |
| 931 | + 'special-livetranslate' => 'Buhay na isalinwika', |
| 932 | + 'livetranslate-tmtype-ltf' => 'Anyo ng Buhay na Pagsasalinwika', |
| 933 | + 'livetranslate-tmtype-tmx' => 'Pagpapalitan ng Alaala ng Pagsasalinwika', |
| 934 | + 'livetranslate-tmtype-gcsv' => 'CSV ng Google', |
| 935 | + 'livetranslate-special-no-tms-yet' => 'Wala pang mga alaala ng pagsasalinwika.', |
| 936 | + 'livetranslate-special-button' => 'Sagipin at isapanahon', |
| 937 | + 'livetranslate-special-type' => 'Uri', |
| 938 | + 'livetranslate-special-location' => 'Kinalalagyan', |
| 939 | + 'livetranslate-special-remove' => 'Alisin', |
| 940 | + 'livetranslate-special-local' => 'Katutubo', |
| 941 | + 'livetranslate-special-add-tm' => 'Magdagdag ng isang bagong alaala ng pagsasalinwika', |
| 942 | + 'livetranslate-special-current-tms' => 'Umiiral na mga alaala ng pagsasalinwika', |
| 943 | + 'livetranslate-special-tms-update' => 'Isapanahon ang mga alaala ng pagsasalinwika', |
| 944 | + 'livetranslate-special-update' => 'Isapanahon ang mga alaala ng pagsasalinwika', |
| 945 | + 'livetranslate-importtms-param-miscmatch' => 'Hindi pagtutugma sa pagitan ng halaga ng mga kinalalagyan at mga uri', |
| 946 | +); |
| 947 | + |
| 948 | +/** Ukrainian (Українська) |
| 949 | + * @author Тест |
| 950 | + */ |
| 951 | +$messages['uk'] = array( |
| 952 | + 'livetranslate-desc' => 'Робить можливим безпосередній переклад вмісту сторінки за допомогою служби Google Translate', |
| 953 | + 'livetranslate-translate-to' => 'Перекласти цю сторінку', |
| 954 | + 'livetranslate-button-translate' => 'Перекласти', |
| 955 | + 'livetranslate-button-translating' => 'Перекладаю...', |
| 956 | + 'livetranslate-button-revert' => 'Показати оригінал', |
| 957 | + 'livetranslate-special-button' => 'Зберегти та оновити', |
| 958 | + 'livetranslate-special-type' => 'Тип', |
| 959 | + 'livetranslate-special-location' => 'Розташування', |
| 960 | + 'livetranslate-special-remove' => 'Вилучити', |
| 961 | +); |
| 962 | + |
| 963 | +/** Simplified Chinese (中文(简体)) |
| 964 | + * @author Hydra |
| 965 | + */ |
| 966 | +$messages['zh-hans'] = array( |
| 967 | + 'livetranslate-button-translate' => '翻译', |
| 968 | + 'livetranslate-button-translating' => '翻译中。。。', |
| 969 | + 'livetranslate-button-revert' => '显示原文', |
| 970 | + 'livetranslate-dictionary-goto-edit' => '修改的翻译记忆库。', |
| 971 | + 'special-livetranslate' => '实时翻译', |
| 972 | + 'livetranslate-tmtype-ltf' => '实时翻译格式', |
| 973 | + 'livetranslate-tmtype-tmx' => '翻译库交换', |
| 974 | + 'livetranslate-tmtype-gcsv' => '谷歌 CSV', |
| 975 | + 'livetranslate-special-no-tms-yet' => '但没有翻译记忆库。', |
| 976 | + 'livetranslate-special-button' => '保存与更新', |
| 977 | + 'livetranslate-special-type' => '类型', |
| 978 | + 'livetranslate-special-location' => '位置', |
| 979 | + 'livetranslate-special-remove' => '删除', |
| 980 | + 'livetranslate-special-local' => '本地', |
| 981 | + 'livetranslate-special-add-tm' => '添加一个新翻译记忆', |
| 982 | + 'livetranslate-special-current-tms' => '现有的翻译记忆库', |
| 983 | + 'livetranslate-special-tms-update' => '更新翻译记忆库', |
| 984 | + 'livetranslate-special-update' => '更新翻译记忆库', |
| 985 | + 'livetranslate-importtms-param-miscmatch' => '之间的位置的数量和类型不匹配', |
| 986 | +); |
| 987 | + |
| 988 | +/** Traditional Chinese (中文(繁體)) |
| 989 | + * @author Mark85296341 |
| 990 | + */ |
| 991 | +$messages['zh-hant'] = array( |
| 992 | + 'livetranslate-translate-to' => '翻譯此頁', |
| 993 | + 'livetranslate-button-translate' => '翻譯', |
| 994 | + 'livetranslate-special-button' => '儲存和更新', |
| 995 | + 'livetranslate-special-type' => '類型', |
| 996 | + 'livetranslate-special-location' => '位置', |
| 997 | + 'livetranslate-special-remove' => '移除', |
| 998 | + 'livetranslate-special-local' => '地點', |
| 999 | + 'livetranslate-special-add-tm' => '增加一個新的翻譯記憶', |
| 1000 | + 'livetranslate-special-current-tms' => '現有的翻譯記憶', |
| 1001 | + 'livetranslate-special-tms-update' => '更新翻譯記憶', |
| 1002 | + 'livetranslate-special-update' => '更新翻譯記憶', |
| 1003 | +); |
| 1004 | + |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 1005 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.php |
— | — | @@ -0,0 +1,133 @@ |
| 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 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 16 | + */ |
| 17 | + |
| 18 | +/** |
| 19 | + * This documentation group collects source code files belonging to Live Translate. |
| 20 | + * |
| 21 | + * @defgroup LiveTranslate Live Translate |
| 22 | + */ |
| 23 | + |
| 24 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 25 | + die( 'Not an entry point.' ); |
| 26 | +} |
| 27 | + |
| 28 | +define( 'LiveTranslate_VERSION', '1.1.1' ); |
| 29 | + |
| 30 | +$wgExtensionCredits['other'][] = array( |
| 31 | + 'path' => __FILE__, |
| 32 | + 'name' => 'Live Translate', |
| 33 | + 'version' => LiveTranslate_VERSION, |
| 34 | + 'author' => array( |
| 35 | + '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw] for [http://www.wikiworks.com WikiWorks]', |
| 36 | + ), |
| 37 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Live_Translate', |
| 38 | + 'descriptionmsg' => 'livetranslate-desc' |
| 39 | +); |
| 40 | + |
| 41 | +$useExtensionPath = version_compare( $wgVersion, '1.16', '>=' ) && isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath; |
| 42 | +$egLiveTranslateScriptPath = ( $useExtensionPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/LiveTranslate'; |
| 43 | +$egLiveTranslateIP = dirname( __FILE__ ); |
| 44 | +unset( $useExtensionPath ); |
| 45 | + |
| 46 | +$wgExtensionMessagesFiles['LiveTranslate'] = $egLiveTranslateIP . '/LiveTranslate.i18n.php'; |
| 47 | +$wgExtensionMessagesFiles['LiveTranslateMagic'] = $egLiveTranslateIP . '/LiveTranslate.i18n.magic.php'; |
| 48 | + |
| 49 | +$wgAutoloadClasses['LiveTranslateHooks'] = $egLiveTranslateIP . '/LiveTranslate.hooks.php'; |
| 50 | +$wgAutoloadClasses['ApiImportTranslationMemories'] = $egLiveTranslateIP . '/api/ApiImportTranslationMemories.php'; |
| 51 | +$wgAutoloadClasses['ApiLiveTranslate'] = $egLiveTranslateIP . '/api/ApiLiveTranslate.php'; |
| 52 | +$wgAutoloadClasses['ApiQueryLiveTranslate'] = $egLiveTranslateIP . '/api/ApiQueryLiveTranslate.php'; |
| 53 | + |
| 54 | +$incDirIP = $egLiveTranslateIP . '/includes/'; |
| 55 | +$wgAutoloadClasses['LiveTranslateFunctions'] = $incDirIP . 'LiveTranslate_Functions.php'; |
| 56 | +$wgAutoloadClasses['LTGCSVParser'] = $incDirIP . 'LT_GCSVParser.php'; |
| 57 | +$wgAutoloadClasses['LTLTFParser'] = $incDirIP . 'LT_LTFParser.php'; |
| 58 | +$wgAutoloadClasses['LTTMParser'] = $incDirIP . 'LT_TMParser.php'; |
| 59 | +$wgAutoloadClasses['LTTMUnit'] = $incDirIP . 'LT_TMUnit.php'; |
| 60 | +$wgAutoloadClasses['LTTMXParser'] = $incDirIP . 'LT_TMXParser.php'; |
| 61 | +$wgAutoloadClasses['LTTranslationMemory'] = $incDirIP . 'LT_TranslationMemory.php'; |
| 62 | +unset( $incDirIP ); |
| 63 | + |
| 64 | +$wgAutoloadClasses['SpecialLiveTranslate'] = $egLiveTranslateIP . '/specials/SpecialLiveTranslate.php'; |
| 65 | + |
| 66 | +$wgSpecialPages['LiveTranslate'] = 'SpecialLiveTranslate'; |
| 67 | +$wgSpecialPageGroups['LiveTranslate'] = 'pagetools'; |
| 68 | + |
| 69 | +$wgAPIModules['importtms'] = 'ApiImportTranslationMemories'; |
| 70 | +$wgAPIModules['livetranslate'] = 'ApiLiveTranslate'; |
| 71 | +$wgAPIListModules['livetranslate'] = 'ApiQueryLiveTranslate'; |
| 72 | + |
| 73 | +$wgHooks['ArticleViewHeader'][] = 'LiveTranslateHooks::onArticleViewHeader'; |
| 74 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'LiveTranslateHooks::onSchemaUpdate'; |
| 75 | +$wgHooks['ArticleSaveComplete'][] = 'LiveTranslateHooks::onArticleSaveComplete'; |
| 76 | +$wgHooks['LanguageGetMagic'][] = 'LiveTranslateHooks::addMagicWords'; |
| 77 | +$wgHooks['InternalParseBeforeLinks'][] = 'LiveTranslateHooks::stripMagicWords'; |
| 78 | +$wgHooks['OutputPageParserOutput'][] = 'LiveTranslateHooks::onOutputPageParserOutput'; |
| 79 | + |
| 80 | +$egLTJSMessages = array( |
| 81 | + 'livetranslate-button-translate', |
| 82 | + 'livetranslate-button-translating', |
| 83 | + 'livetranslate-dictionary-error', |
| 84 | +); |
| 85 | + |
| 86 | +// For backward compatibility with MW < 1.17. |
| 87 | +if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) { |
| 88 | + $moduleTemplate = array( |
| 89 | + 'localBasePath' => dirname( __FILE__ ), |
| 90 | + 'remoteBasePath' => $egLiveTranslateScriptPath, |
| 91 | + 'group' => 'ext.livetranslate' |
| 92 | + ); |
| 93 | + |
| 94 | + $wgResourceModules['ext.livetranslate'] = $moduleTemplate + array( |
| 95 | + 'scripts' => array( 'includes/ext.livetranslate.js' ), |
| 96 | + 'dependencies' => array( 'jquery' ), |
| 97 | + 'messages' => $egLTJSMessages |
| 98 | + ); |
| 99 | + |
| 100 | + $wgResourceModules['ext.lt.google'] = $moduleTemplate + array( |
| 101 | + 'scripts' => array( 'includes/ext.lt.google.js' ), |
| 102 | + 'dependencies' => array( 'ext.livetranslate' ), |
| 103 | + 'messages' => array() |
| 104 | + ); |
| 105 | + |
| 106 | + $wgResourceModules['ext.lt.ms'] = $moduleTemplate + array( |
| 107 | + 'scripts' => array( 'includes/ext.lt.ms.js' ), |
| 108 | + 'dependencies' => array( 'ext.livetranslate' ), |
| 109 | + 'messages' => array() |
| 110 | + ); |
| 111 | +} |
| 112 | + |
| 113 | +/** |
| 114 | + * Enum for translation memory types. |
| 115 | + * |
| 116 | + * @since 0.4 |
| 117 | + */ |
| 118 | +define( 'TMT_LTF', 0 ); |
| 119 | +define( 'TMT_TMX', 1 ); |
| 120 | +define( 'TMT_GCSV', 2 ); |
| 121 | + |
| 122 | +/** |
| 123 | + * Enum for translation services. |
| 124 | + * |
| 125 | + * @since 1.1 |
| 126 | + */ |
| 127 | +define( 'LTS_GOOGLE', 0 ); |
| 128 | +define( 'LTS_MS', 1 ); |
| 129 | + |
| 130 | +$egLiveTranslateMagicWords = array(); |
| 131 | + |
| 132 | +require_once 'LiveTranslate_Settings.php'; |
| 133 | + |
| 134 | +$wgAvailableRights[] = 'managetms'; |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 135 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate_Settings.php |
— | — | @@ -0,0 +1,72 @@ |
| 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 copying 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 | +# A list of languages that should be available to translate to. |
| 23 | +$egLiveTranslateLanguages = array( |
| 24 | + $wgLanguageCode, |
| 25 | +); |
| 26 | + |
| 27 | +# Permission to mannage translation memories. |
| 28 | +$wgGroupPermissions['sysop']['managetms'] = true; |
| 29 | + |
| 30 | +# Default translation memory type. |
| 31 | +# TMT_LTF, TMT_TMX, TMT_GCSV |
| 32 | +$egLiveTranslateTMT = TMT_LTF; |
| 33 | + |
| 34 | +# Translation service to use. |
| 35 | +# LTS_GOOGLE, LTS_MS |
| 36 | +$egLiveTranslateService = LTS_GOOGLE; |
| 37 | + |
| 38 | +# The namespaces that should show the translation control. |
| 39 | +$egLTNSWithTranslationControl = array( |
| 40 | + NS_MAIN => true, |
| 41 | + NS_TALK => false, |
| 42 | + NS_USER => true, |
| 43 | + NS_USER_TALK => false, |
| 44 | + NS_PROJECT => true, |
| 45 | + NS_PROJECT_TALK => false, |
| 46 | + NS_IMAGE => true, |
| 47 | + NS_IMAGE_TALK => false, |
| 48 | + NS_MEDIAWIKI => false, |
| 49 | + NS_MEDIAWIKI_TALK => false, |
| 50 | + NS_TEMPLATE => false, |
| 51 | + NS_TEMPLATE_TALK => false, |
| 52 | + NS_HELP => true, |
| 53 | + NS_HELP_TALK => false, |
| 54 | + NS_CATEGORY => true, |
| 55 | + NS_CATEGORY_TALK => false, |
| 56 | +); |
| 57 | + |
| 58 | +# Show the control for namespaces not specified in $egLTNSWithTranslationControl? |
| 59 | +$egLTUnknownNSShowControl = true; |
| 60 | + |
| 61 | +# When true, this prevents storange of translations that are the same in the source and target language. |
| 62 | +$egLTRequireSignificance = false; |
| 63 | + |
| 64 | +# When true, debugging messages will be logged using console.log(). Do not use on production wikis. |
| 65 | +$egLiveTranslateDebugJS = false; |
| 66 | + |
| 67 | +# Google API key, needed when using the Google Translation service. |
| 68 | +# https://code.google.com/apis/console |
| 69 | +$egGoogleApiKey = ''; |
| 70 | + |
| 71 | +# Microsoft App Id, needed when using the Microsoft Translation service. |
| 72 | +# http://www.bing.com/developers/createapp.aspx |
| 73 | +$egLiveTranslateMSAppId = ''; |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate_Settings.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 74 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/specials/SpecialLiveTranslate.php |
— | — | @@ -0,0 +1,367 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Page to manage LiveTranslate translation memories. |
| 6 | + * |
| 7 | + * @since 0.4 |
| 8 | + * |
| 9 | + * @file SpecialLiveTranslate.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class SpecialLiveTranslate extends SpecialPage { |
| 16 | + |
| 17 | + /** |
| 18 | + * Constructor. |
| 19 | + * |
| 20 | + * @since 0.4 |
| 21 | + */ |
| 22 | + public function __construct() { |
| 23 | + parent::__construct( 'LiveTranslate', 'managetms' ); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * @see SpecialPage::getDescription |
| 28 | + * |
| 29 | + * @since 0.4 |
| 30 | + */ |
| 31 | + public function getDescription() { |
| 32 | + return wfMsg( 'special-' . strtolower( $this->mName ) ); |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Sets headers - this should be called from the execute() method of all derived classes! |
| 37 | + * |
| 38 | + * @since 0.4 |
| 39 | + */ |
| 40 | + public function setHeaders() { |
| 41 | + global $wgOut; |
| 42 | + $wgOut->setArticleRelated( false ); |
| 43 | + $wgOut->setRobotPolicy( "noindex,nofollow" ); |
| 44 | + $wgOut->setPageTitle( $this->getDescription() ); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Main method. |
| 49 | + * |
| 50 | + * @since 0.4 |
| 51 | + * |
| 52 | + * @param string $arg |
| 53 | + */ |
| 54 | + public function execute( $arg ) { |
| 55 | + global $wgOut, $wgUser, $wgRequest; |
| 56 | + |
| 57 | + $this->setHeaders(); |
| 58 | + $this->outputHeader(); |
| 59 | + |
| 60 | + // If the user is authorized, display the page, if not, show an error. |
| 61 | + if ( !$this->userCanExecute( $wgUser ) ) { |
| 62 | + $this->displayRestrictionError(); |
| 63 | + return; |
| 64 | + } |
| 65 | + |
| 66 | + if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
| 67 | + $this->handleSubmission(); |
| 68 | + } |
| 69 | + |
| 70 | + $tms = $this->getTMConfigItems(); |
| 71 | + |
| 72 | + $this->displayTMConfig( $tms ); |
| 73 | + |
| 74 | + $this->updateTranslationMemory( $tms ); |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Handles the submission of the config form. |
| 79 | + * |
| 80 | + * @since 0.4 |
| 81 | + */ |
| 82 | + protected function handleSubmission() { |
| 83 | + global $wgRequest; |
| 84 | + |
| 85 | + $tms = $this->getTMConfigItems(); |
| 86 | + |
| 87 | + $dbw = wfGetDB( DB_MASTER ); |
| 88 | + |
| 89 | + // Loop over the existing translation memories and update/delete them if requested. |
| 90 | + foreach ( $tms as $tm ) { |
| 91 | + // If a delete has been requested, remove the item. |
| 92 | + if ( $wgRequest->getCheck( 'tmdel-' . $tm->memory_id ) ) { |
| 93 | + $dbw->delete( |
| 94 | + 'live_translate_memories', |
| 95 | + array( 'memory_id' => $tm->memory_id ) |
| 96 | + ); |
| 97 | + } |
| 98 | + // If changes where made, apply them in the db. |
| 99 | + elseif ( |
| 100 | + $wgRequest->getText( 'tmlocation-' . $tm->memory_id ) != $tm->memory_location |
| 101 | + || $wgRequest->getInt( 'wptmtype-' . $tm->memory_id ) != $tm->memory_type |
| 102 | + || ( $wgRequest->getCheck( 'tmlocal-' . $tm->memory_id ) ? 1 : 0 ) != $tm->memory_local |
| 103 | + ) { |
| 104 | + $dbw->update( |
| 105 | + 'live_translate_memories', |
| 106 | + array( |
| 107 | + 'memory_location' => $wgRequest->getText( 'tmlocation-' . $tm->memory_id ), |
| 108 | + 'memory_type' => $wgRequest->getInt( 'wptmtype-' . $tm->memory_id ), |
| 109 | + 'memory_local' => $wgRequest->getCheck( 'tmlocal-' . $tm->memory_id ) ? 1 : 0 |
| 110 | + ), |
| 111 | + array( 'memory_id' => $tm->memory_id ) |
| 112 | + ); |
| 113 | + } |
| 114 | + } |
| 115 | + |
| 116 | + // If there is a new item, insert it. |
| 117 | + if ( $wgRequest->getText( 'newtm-location' ) != '' ) { |
| 118 | + $dbw->insert( |
| 119 | + 'live_translate_memories', |
| 120 | + array( |
| 121 | + 'memory_type' => $wgRequest->getInt( 'wpnewtm-type' ), |
| 122 | + 'memory_location' => $wgRequest->getText( 'newtm-location' ), |
| 123 | + 'memory_local' => $wgRequest->getCheck( 'newtm-local' ) ? 1 : 0 |
| 124 | + ) |
| 125 | + ); |
| 126 | + } |
| 127 | + } |
| 128 | + |
| 129 | + /** |
| 130 | + * Updates the translation memory stored in the db. |
| 131 | + * |
| 132 | + * @since 0.4 |
| 133 | + * |
| 134 | + * @param array $tms The current translation memories |
| 135 | + */ |
| 136 | + protected function updateTranslationMemory( array $tms ) { |
| 137 | + $dbr = wfGetDB( DB_SLAVE ); |
| 138 | + |
| 139 | + // Just drop everything and rebuild the entire translation memory. |
| 140 | + $dbr->query( 'TRUNCATE TABLE ' . $dbr->tableName( 'live_translate' ) ); |
| 141 | + |
| 142 | + foreach ( $tms as $tm ) { |
| 143 | + $requestData = array( |
| 144 | + 'action' => 'importtms', |
| 145 | + 'format' => 'json', |
| 146 | + 'source' => $tm->memory_location, |
| 147 | + 'type' => $tm->memory_type, |
| 148 | + 'local' => $tm->memory_local, |
| 149 | + ); |
| 150 | + |
| 151 | + $api = new ApiMain( new FauxRequest( $requestData, true ), true ); |
| 152 | + $api->execute(); |
| 153 | + $response = $api->getResultData(); |
| 154 | + } |
| 155 | + } |
| 156 | + |
| 157 | + /** |
| 158 | + * Displays the translation memories config table. |
| 159 | + * |
| 160 | + * @since 0.4 |
| 161 | + * |
| 162 | + * @param array $tms The current translation memories |
| 163 | + */ |
| 164 | + protected function displayTMConfig( array $tms ) { |
| 165 | + global $wgOut, $wgUser; |
| 166 | + |
| 167 | + $wgOut->addHtml( Xml::openElement( |
| 168 | + 'form', |
| 169 | + array( |
| 170 | + 'id' => 'tmform', |
| 171 | + 'name' => 'tmform', |
| 172 | + 'method' => 'post', |
| 173 | + 'action' => $this->getTitle()->getLocalURL(), |
| 174 | + ) |
| 175 | + ) ); |
| 176 | + |
| 177 | + if ( count( $tms ) > 0 ) { |
| 178 | + /* |
| 179 | + $wgOut->addHTML( '<h3>' . htmlspecialchars( wfMsg( 'livetranslate-special-tms-update' ) ) . '</h3>' ); |
| 180 | + |
| 181 | + $wgOut->addHTML( |
| 182 | + Html::input( |
| 183 | + '', |
| 184 | + wfMsg( 'livetranslate-special-update' ), |
| 185 | + 'submit', |
| 186 | + array( 'id' => 'tmform-updatesubmit' ) |
| 187 | + ) |
| 188 | + ); |
| 189 | + */ |
| 190 | + |
| 191 | + $wgOut->addHTML( '<h3>' . htmlspecialchars( wfMsg( 'livetranslate-special-current-tms' ) ) . '</h3>' ); |
| 192 | + |
| 193 | + $wgOut->addHTML( Xml::openElement( |
| 194 | + 'table', |
| 195 | + array( 'class' => 'wikitable', 'style' => 'width:50%' ) |
| 196 | + ) ); |
| 197 | + |
| 198 | + $wgOut->addHTML( Html::rawElement( |
| 199 | + 'tr', |
| 200 | + array(), |
| 201 | + Html::element( 'th', array( 'width' => '400px' ), wfMsg( 'livetranslate-special-location' ) ) . |
| 202 | + Html::element( 'th', array( 'width' => '160px' ), wfMsg( 'livetranslate-special-type' ) ) . |
| 203 | + Html::element( 'th', array( 'width' => '160px' ), wfMsg( 'livetranslate-special-local' ) ) . |
| 204 | + Html::element( 'th', array( 'width' => '100px' ), wfMsg( 'livetranslate-special-remove' ) ) |
| 205 | + ) ); |
| 206 | + |
| 207 | + foreach ( $tms as $tm ) { |
| 208 | + $this->displayTMItem( $tm ); |
| 209 | + } |
| 210 | + |
| 211 | + $wgOut->addHTML( Xml::closeElement( 'table' ) ); |
| 212 | + } |
| 213 | + else { |
| 214 | + $wgOut->addWikiMsg( 'livetranslate-special-no-tms-yet' ); |
| 215 | + } |
| 216 | + |
| 217 | + $this->displayAddNewTM(); |
| 218 | + |
| 219 | + $wgOut->addHtml( |
| 220 | + '<br />' . |
| 221 | + Html::input( |
| 222 | + '', |
| 223 | + wfMsg( 'livetranslate-special-button' ), |
| 224 | + 'submit', |
| 225 | + array( 'id' => 'tmform-submit' ) |
| 226 | + ) . |
| 227 | + Html::hidden( 'wpEditToken', $wgUser->editToken() ) . |
| 228 | + Xml::closeElement( 'form' ) |
| 229 | + ); |
| 230 | + } |
| 231 | + |
| 232 | + /** |
| 233 | + * Displays a single row in the translation memories config table. |
| 234 | + * |
| 235 | + * @since 0.4 |
| 236 | + * |
| 237 | + * @return array |
| 238 | + */ |
| 239 | + protected function getTMConfigItems() { |
| 240 | + $dbr = wfGetDB( DB_SLAVE ); |
| 241 | + |
| 242 | + $res = $dbr->select( |
| 243 | + 'live_translate_memories', |
| 244 | + array( 'memory_id', 'memory_type', 'memory_location', 'memory_local' ), |
| 245 | + array(), |
| 246 | + __METHOD__, |
| 247 | + array( 'LIMIT' => '5000' ) |
| 248 | + ); |
| 249 | + |
| 250 | + $tms = array(); |
| 251 | + |
| 252 | + // Iterate over the result items in the result wrapper to end up with a regular array. |
| 253 | + foreach ( $res as $tm ) { |
| 254 | + $tms[] = $tm; |
| 255 | + } |
| 256 | + |
| 257 | + return $tms; |
| 258 | + } |
| 259 | + |
| 260 | + /** |
| 261 | + * Displays a single row in the translation memories config table. |
| 262 | + * |
| 263 | + * @since 0.4 |
| 264 | + * |
| 265 | + * @param object $tm |
| 266 | + */ |
| 267 | + protected function displayTMItem( $tm ) { |
| 268 | + global $wgOut; |
| 269 | + |
| 270 | + $wgOut->addHTML( Html::rawElement( |
| 271 | + 'tr', |
| 272 | + array(), |
| 273 | + Html::rawElement( |
| 274 | + 'td', |
| 275 | + array(), |
| 276 | + Html::input( 'tmlocation-' . $tm->memory_id, $tm->memory_location, 'text', array( 'size' => 60 ) ) |
| 277 | + ) . |
| 278 | + Html::rawElement( |
| 279 | + 'td', |
| 280 | + array(), |
| 281 | + $this->getTypeSelector( 'tmtype-' . $tm->memory_id, $tm->memory_type ) |
| 282 | + ) . |
| 283 | + Html::rawElement( |
| 284 | + 'td', |
| 285 | + array( 'style' => 'text-align:center' ), |
| 286 | + Xml::check( 'tmlocal-' . $tm->memory_id, $tm->memory_local != "0" ) |
| 287 | + ) . |
| 288 | + Html::rawElement( |
| 289 | + 'td', |
| 290 | + array( 'style' => 'text-align:center' ), |
| 291 | + Xml::check( 'tmdel-' . $tm->memory_id, false ) |
| 292 | + ) |
| 293 | + ) ); |
| 294 | + } |
| 295 | + |
| 296 | + /** |
| 297 | + * Displays an input to add a new translation memory. |
| 298 | + * |
| 299 | + * @since 0.4 |
| 300 | + */ |
| 301 | + protected function displayAddNewTM() { |
| 302 | + global $wgOut, $egLiveTranslateTMT; |
| 303 | + |
| 304 | + $wgOut->addHTML( '<h3>' . htmlspecialchars( wfMsg( 'livetranslate-special-add-tm' ) ) . '</h3>' ); |
| 305 | + |
| 306 | + $wgOut->addHTML( |
| 307 | + '<table><tr>' . |
| 308 | + '<td><b>' . htmlspecialchars( wfMsg( 'livetranslate-special-type' ) ) . ': </b></td>' . |
| 309 | + '<td>' . $this->getTypeSelector( 'newtm-type', $egLiveTranslateTMT ) . '</td>' . |
| 310 | + '</tr><tr>' . |
| 311 | + '<td><b>' . htmlspecialchars( wfMsg( 'livetranslate-special-location' ) ) . ': </b></td>' . |
| 312 | + '<td>' . Html::input( 'newtm-location', '', 'text', array( 'size' => 75 ) ) . '</td>' . |
| 313 | + '</tr><tr>' . |
| 314 | + '<td><b>' . htmlspecialchars( wfMsg( 'livetranslate-special-local' ) ) . ': </b></td>' . |
| 315 | + '<td>' . Xml::check( 'newtm-local', false ) . '</td>' . |
| 316 | + '</tr></table>' |
| 317 | + ); |
| 318 | + } |
| 319 | + |
| 320 | + /** |
| 321 | + * Builds up an HTML select for translation memory types with the provided name. |
| 322 | + * The value parameter allows setting which item should be selected. |
| 323 | + * |
| 324 | + * @since 0.4 |
| 325 | + * |
| 326 | + * @param string $name |
| 327 | + * @param string $value |
| 328 | + * |
| 329 | + * @return string |
| 330 | + */ |
| 331 | + protected function getTypeSelector( $name, $value ) { |
| 332 | + $typeSelector = new HTMLSelectField( array( |
| 333 | + 'fieldname' => $name, |
| 334 | + 'options' => $this->getTypeOptions() |
| 335 | + ) ); |
| 336 | + |
| 337 | + return $typeSelector->getInputHTML( $value ); |
| 338 | + } |
| 339 | + |
| 340 | + /** |
| 341 | + * Returns an array with the translation memory type names (keys) |
| 342 | + * and their database values (values). |
| 343 | + * |
| 344 | + * @since 0.4 |
| 345 | + * |
| 346 | + * @return array |
| 347 | + */ |
| 348 | + protected function getTypeOptions() { |
| 349 | + static $options = false; |
| 350 | + |
| 351 | + if ( $options === false ) { |
| 352 | + $options = array(); |
| 353 | + |
| 354 | + $tmTypes = array( |
| 355 | + TMT_LTF => 'ltf', |
| 356 | + TMT_TMX => 'tmx', |
| 357 | + TMT_GCSV => 'gcsv', |
| 358 | + ); |
| 359 | + |
| 360 | + foreach ( $tmTypes as $dbValue => $msgKey ) { |
| 361 | + $options[wfMsg( 'livetranslate-tmtype-' . $msgKey )] = $dbValue; |
| 362 | + } |
| 363 | + } |
| 364 | + |
| 365 | + return $options; |
| 366 | + } |
| 367 | + |
| 368 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/specials/SpecialLiveTranslate.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 369 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.hooks.php |
— | — | @@ -0,0 +1,354 @@ |
| 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 | + * Hook to insert things into article headers. |
| 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 $egLiveTranslateLanguages; |
| 29 | + |
| 30 | + $title = $article->getTitle(); |
| 31 | + |
| 32 | + $currentLang = LiveTranslateFunctions::getCurrentLang( $title ); |
| 33 | + |
| 34 | + // FIXME: Hitting the db on every page load should be avoided |
| 35 | + if ( in_array( $title->getFullText(), LiveTranslateFunctions::getLocalMemoryNames() ) ) { |
| 36 | + self::displayDictionaryPage( $article, $title ); |
| 37 | + $outputDone = true; // The translations themselves should not be shown. |
| 38 | + } |
| 39 | + elseif ( |
| 40 | + LiveTranslateFunctions::hasTranslationService() |
| 41 | + && $article->exists() |
| 42 | + && ( count( $egLiveTranslateLanguages ) > 1 || ( count( $egLiveTranslateLanguages ) == 1 && $egLiveTranslateLanguages[0] != $currentLang ) ) ) { |
| 43 | + |
| 44 | + global $wgParser; |
| 45 | + $po = $wgParser->getOutput(); |
| 46 | + $magicWords = isset( $po->mLTMagicWords ) ? $po->mLTMagicWords : array(); |
| 47 | + |
| 48 | + if ( !in_array( 'LT_NOTRANSLATIONCONTROL', $magicWords ) ) { |
| 49 | + global $egLTNSWithTranslationControl, $egLTUnknownNSShowControl; |
| 50 | + $ns = $title->getNamespace(); |
| 51 | + |
| 52 | + if ( in_array( 'LT_SHOWTRANSLATIONCONTROL', $magicWords ) |
| 53 | + || ( array_key_exists( $ns, $egLTNSWithTranslationControl ) && $egLTNSWithTranslationControl[$ns] ) |
| 54 | + || ( !array_key_exists( $ns, $egLTNSWithTranslationControl ) && $egLTUnknownNSShowControl ) |
| 55 | + ) { |
| 56 | + self::displayTranslationControl( $currentLang ); |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + return true; |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * Displays some shorts statistics about the dictionary page. |
| 66 | + * |
| 67 | + * @since 0.4 |
| 68 | + * |
| 69 | + * @param Article $article |
| 70 | + * @param Title $title |
| 71 | + */ |
| 72 | + protected static function displayDictionaryPage( Article &$article, Title $title ) { |
| 73 | + global $wgOut, $wgLang, $wgUser, $egLiveTranslateLanguages; |
| 74 | + |
| 75 | + $dbr = wfGetDb( DB_SLAVE ); |
| 76 | + |
| 77 | + $res = $dbr->select( |
| 78 | + 'live_translate_memories', |
| 79 | + array( |
| 80 | + 'memory_lang_count', |
| 81 | + 'memory_tu_count' |
| 82 | + ), |
| 83 | + array( 'memory_location' => $title->getFullText() ), |
| 84 | + array( 'LIMIT' => 1 ) |
| 85 | + ); |
| 86 | + |
| 87 | + foreach ( $res as $tm ) { |
| 88 | + break; |
| 89 | + } |
| 90 | + |
| 91 | + if ( $tm->memory_tu_count == 0 ) { |
| 92 | + $wgOut->addWikiMsg( 'livetranslate-dictionary-empty' ); |
| 93 | + } |
| 94 | + else { |
| 95 | + $wgOut->addWikiMsg( |
| 96 | + 'livetranslate-dictionary-count', |
| 97 | + $wgLang->formatNum( $tm->memory_tu_count ) , |
| 98 | + $wgLang->formatNum( $tm->memory_lang_count ) |
| 99 | + ); |
| 100 | + |
| 101 | + /* |
| 102 | + $notAllowedLanguages = array(); |
| 103 | + |
| 104 | + foreach ( $tus[0]->getVariants() as $languageCode => $translations ) { |
| 105 | + $languageCode = strtolower( $languageCode ); |
| 106 | + $mappings = LiveTranslateFunctions::getInputLangMapping(); |
| 107 | + |
| 108 | + if ( array_key_exists( $languageCode, $mappings ) ) { |
| 109 | + $languageCode = $mappings[$languageCode]; |
| 110 | + } |
| 111 | + |
| 112 | + if ( !in_array( $languageCode, $egLiveTranslateLanguages ) ) { |
| 113 | + $notAllowedLanguages[] = $languageCode; |
| 114 | + } |
| 115 | + } |
| 116 | + |
| 117 | + if ( count( $notAllowedLanguages ) > 0 ) { |
| 118 | + $languages = Language::getLanguageNames( false ); |
| 119 | + |
| 120 | + foreach ( $notAllowedLanguages as &$notAllowedLang ) { |
| 121 | + if ( array_key_exists( $notAllowedLang, $languages ) ) { |
| 122 | + $notAllowedLang = $languages[$notAllowedLang]; |
| 123 | + } |
| 124 | + } |
| 125 | + |
| 126 | + $wgOut->addHTML( |
| 127 | + Html::element( |
| 128 | + 'span', |
| 129 | + array( 'style' => 'color:darkred' ), |
| 130 | + wfMsgExt( 'livetranslate-dictionary-unallowed-langs', 'parsemag', $wgLang->listToText( $notAllowedLanguages ), count( $notAllowedLanguages ) ) |
| 131 | + ) |
| 132 | + ); |
| 133 | + } |
| 134 | + */ |
| 135 | + } |
| 136 | + |
| 137 | + if ( $wgUser->isAllowed( 'managetms' ) ) { |
| 138 | + $wgOut->addHTML( |
| 139 | + Html::element( |
| 140 | + 'a', |
| 141 | + array( 'href' => Title::newFromText( 'Special:LiveTranslate' )->getInternalURL() ), |
| 142 | + wfMsg( 'livetranslate-dictionary-goto-edit' ) |
| 143 | + ) |
| 144 | + ); |
| 145 | + } |
| 146 | + } |
| 147 | + |
| 148 | + /** |
| 149 | + * Outputs the Live Translate translation control. |
| 150 | + * |
| 151 | + * @since 0.4 |
| 152 | + * |
| 153 | + * @param string $currentLang |
| 154 | + */ |
| 155 | + protected static function displayTranslationControl( $currentLang ) { |
| 156 | + global $wgOut; |
| 157 | + |
| 158 | + $divContents = htmlspecialchars( wfMsg( 'livetranslate-translate-to' ) ) . |
| 159 | + ' ' . |
| 160 | + LiveTranslateFunctions::getLanguageSelector( $currentLang ) . |
| 161 | + ' ' . |
| 162 | + Html::element( |
| 163 | + 'button', |
| 164 | + array( 'id' => 'livetranslatebutton' ), |
| 165 | + wfMsg( 'livetranslate-button-translate' ) |
| 166 | + ) . |
| 167 | + ' ' . |
| 168 | + Html::element( |
| 169 | + 'button', |
| 170 | + array( 'id' => 'ltrevertbutton', 'style' => 'display:none' ), |
| 171 | + wfMsg( 'livetranslate-button-revert' ) |
| 172 | + ); |
| 173 | + |
| 174 | + if ( $GLOBALS['egLiveTranslateService'] == LTS_GOOGLE ) { |
| 175 | + $divContents .= '<br /><br /><div id="googlebranding" style="display:inline; position:absolute; right: 0px"></div>'; |
| 176 | + } |
| 177 | + |
| 178 | + $wgOut->addHTML( |
| 179 | + Html::rawElement( |
| 180 | + 'div', |
| 181 | + array( |
| 182 | + 'id' => 'livetranslatediv', |
| 183 | + 'style' => 'display:inline; float:right', |
| 184 | + 'class' => 'notranslate', |
| 185 | + 'sourcelang' => $currentLang |
| 186 | + ), |
| 187 | + $divContents |
| 188 | + ) |
| 189 | + ); |
| 190 | + |
| 191 | + LiveTranslateFunctions::loadJs(); |
| 192 | + } |
| 193 | + |
| 194 | + /** |
| 195 | + * Schema update to set up the needed database tables. |
| 196 | + * |
| 197 | + * @since 0.1 |
| 198 | + * |
| 199 | + * @param DatabaseUpdater $updater |
| 200 | + * |
| 201 | + * @return true |
| 202 | + */ |
| 203 | + public static function onSchemaUpdate( /* DatabaseUpdater */ $updater = null ) { |
| 204 | + global $wgDBtype, $egLiveTranslateIP; |
| 205 | + |
| 206 | + if ( $wgDBtype == 'mysql' ) { |
| 207 | + // Set up the current schema. |
| 208 | + if ( $updater === null ) { |
| 209 | + global $wgExtNewTables, $wgExtNewIndexes, $wgExtNewFields; |
| 210 | + |
| 211 | + $wgExtNewTables[] = array( |
| 212 | + 'live_translate', |
| 213 | + $egLiveTranslateIP . '/LiveTranslate.sql', |
| 214 | + true |
| 215 | + ); |
| 216 | + $wgExtNewTables[] = array( |
| 217 | + 'live_translate_memories', |
| 218 | + $egLiveTranslateIP . '/LiveTranslate.sql', |
| 219 | + true |
| 220 | + ); |
| 221 | + |
| 222 | + $wgExtNewIndexes[] = array( |
| 223 | + 'live_translate', |
| 224 | + 'word_translation', |
| 225 | + $egLiveTranslateIP . '/sql/LT_IndexWordTranslation.sql', |
| 226 | + true |
| 227 | + ); |
| 228 | + |
| 229 | + $wgExtNewFields[] = array( |
| 230 | + 'live_translate', |
| 231 | + 'memory_id', |
| 232 | + $egLiveTranslateIP . '/sql/LT_addTMField.sql' |
| 233 | + ); |
| 234 | + } |
| 235 | + else { |
| 236 | + $updater->addExtensionUpdate( array( |
| 237 | + 'addTable', |
| 238 | + 'live_translate', |
| 239 | + $egLiveTranslateIP . '/LiveTranslate.sql', |
| 240 | + true |
| 241 | + ) ); |
| 242 | + $updater->addExtensionUpdate( array( |
| 243 | + 'addTable', |
| 244 | + 'live_translate_memories', |
| 245 | + $egLiveTranslateIP . '/LiveTranslate.sql', |
| 246 | + true |
| 247 | + ) ); |
| 248 | + |
| 249 | + $updater->addExtensionUpdate( array( |
| 250 | + 'addIndex', |
| 251 | + 'live_translate', |
| 252 | + 'word_translation', |
| 253 | + $egLiveTranslateIP . '/sql/LT_IndexWordTranslation.sql', |
| 254 | + true |
| 255 | + ) ); |
| 256 | + |
| 257 | + $updater->addExtensionUpdate( array( |
| 258 | + 'addField', |
| 259 | + 'live_translate', |
| 260 | + 'memory_id', |
| 261 | + $egLiveTranslateIP . '/sql/LT_addTMField.sql', |
| 262 | + true |
| 263 | + ) ); |
| 264 | + } |
| 265 | + } |
| 266 | + |
| 267 | + return true; |
| 268 | + } |
| 269 | + |
| 270 | + /** |
| 271 | + * Handles edits to the dictionary page to save the translations into the db. |
| 272 | + * |
| 273 | + * @since 0.1 |
| 274 | + * |
| 275 | + * @return true |
| 276 | + */ |
| 277 | + public static function onArticleSaveComplete( &$article, &$user, $text, $summary, |
| 278 | + $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect = null ) { |
| 279 | + |
| 280 | + $title = $article->getTitle(); |
| 281 | + |
| 282 | + // FIXME: Hitting the db on every page save should be avoided |
| 283 | + if ( in_array( $title->getFullText(), LiveTranslateFunctions::getLocalMemoryNames() ) ) { |
| 284 | + $requestData = array( |
| 285 | + 'action' => 'importtms', |
| 286 | + 'format' => 'json', |
| 287 | + 'source' => $title->getFullText(), |
| 288 | + 'type' => LiveTranslateFunctions::getMemoryType( $title->getFullText() ), |
| 289 | + 'local' => 1 |
| 290 | + ); |
| 291 | + |
| 292 | + $api = new ApiMain( new FauxRequest( $requestData, true ), true ); |
| 293 | + $api->execute(); |
| 294 | + $response = $api->getResultData(); |
| 295 | + } |
| 296 | + |
| 297 | + return true; |
| 298 | + } |
| 299 | + |
| 300 | + /** |
| 301 | + * Registers the magic words to show and hide the translation control. |
| 302 | + * |
| 303 | + * TODO: apparently there is some new way of doing this for quite a while, |
| 304 | + * which is not linked in the docs. If someone cares to explain the new stuff, |
| 305 | + * I'll be happy to update this. |
| 306 | + * |
| 307 | + * @since 0.6 |
| 308 | + * |
| 309 | + * @param array &$magicWords |
| 310 | + * @param string $langCode |
| 311 | + * |
| 312 | + * @return true |
| 313 | + */ |
| 314 | + public static function addMagicWords( array &$magicWords, $langCode ) { |
| 315 | + $magicWords['LT_NOTRANSLATIONCONTROL'] = array( 0, '__NOTRANSLATIONCONTROL__' ); |
| 316 | + $magicWords['LT_SHOWTRANSLATIONCONTROL'] =array( 0, '__SHOWTRANSLATIONCONTROL__' ); |
| 317 | + |
| 318 | + return true; |
| 319 | + } |
| 320 | + |
| 321 | + /** |
| 322 | + * Strips the magic words added by Live Translate from the page text. |
| 323 | + * |
| 324 | + * @since 0.6 |
| 325 | + * |
| 326 | + * @param Parser &$parser |
| 327 | + * @param string &$text |
| 328 | + * |
| 329 | + * @return true |
| 330 | + */ |
| 331 | + public static function stripMagicWords( Parser &$parser, &$text ) { |
| 332 | + global $egLiveTranslateMagicWords; |
| 333 | + |
| 334 | + $mw = MagicWord::get( 'LT_NOTRANSLATIONCONTROL' ); |
| 335 | + if ( $mw->matchAndRemove( $text ) ) { |
| 336 | + $egLiveTranslateMagicWords[] = 'LT_NOTRANSLATIONCONTROL'; |
| 337 | + } |
| 338 | + |
| 339 | + $mw = MagicWord::get( 'LT_SHOWTRANSLATIONCONTROL' ); |
| 340 | + if ( $mw->matchAndRemove( $text ) ) { |
| 341 | + $egLiveTranslateMagicWords[] = 'LT_SHOWTRANSLATIONCONTROL'; |
| 342 | + } |
| 343 | + |
| 344 | + $po = $parser->getOutput(); |
| 345 | + $po->mLTMagicWords = $egLiveTranslateMagicWords; |
| 346 | + |
| 347 | + return true; |
| 348 | + } |
| 349 | + |
| 350 | + public static function onOutputPageParserOutput( $outputpage, $parseroutput ) { |
| 351 | + $magicWords = isset( $parseroutput->mLTMagicWords ) ? $parseroutput->mLTMagicWords : array(); |
| 352 | + return true; |
| 353 | + } |
| 354 | + |
| 355 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 356 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/INSTALL |
— | — | @@ -0,0 +1,69 @@ |
| 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 | +You also need to run this when upgrading to version 0.4 or above from any older version. |
| 18 | + |
| 19 | +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: |
| 20 | + |
| 21 | +== Configuration == |
| 22 | + |
| 23 | +Configuration of Live Translate is done by adding simple PHP statements to your [[Manual:LocalSettings.php|LocalSettings.php]] |
| 24 | +file. These statements need to be placed AFTER the inclusion of Live Translate. The options are listed below and their default |
| 25 | +is set in the [http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/LiveTranslate/LiveTranslate_Settings.php?view=markup Live Translate settings file]. |
| 26 | +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. |
| 27 | + |
| 28 | +=== Available languages === |
| 29 | + |
| 30 | +You have to specify which languages users should be able to translate to. This is done by adding language codes to <code>$egLiveTranslateLanguages</code>. |
| 31 | +By default it contains only your wikis main language (as specified by <code>$wgLanguageCode</code> in [[LocalSettings.php]]). You add languages as follows: |
| 32 | + |
| 33 | +$egLiveTranslateLanguages[] = 'nl'; |
| 34 | +$egLiveTranslateLanguages[] = 'de'; |
| 35 | + |
| 36 | +If there are no languages available other then the current language of the page, then the translation control will not show up. |
| 37 | + |
| 38 | +=== Translation service === |
| 39 | + |
| 40 | +As of Live Translate 1.1, you can make use of either the Google Translate or Micorosft Translation services. |
| 41 | +You can specify the service with the following setting: |
| 42 | + |
| 43 | +# Translation service to use. |
| 44 | +$egLiveTranslateService = LTS_GOOGLE; |
| 45 | + |
| 46 | +Available values are LTS_GOOGLE and LTS_MS. The default is LTS_GOOGLE. |
| 47 | + |
| 48 | +==== Google API key ==== |
| 49 | + |
| 50 | +To be able to use the Google Translate service, you need to [https://code.google.com/apis/console get an API key] and |
| 51 | +add it to your [[LocalSettings.php]] file AFTER the inclusion of the extension. |
| 52 | + |
| 53 | +# Google API key |
| 54 | +$egGoogleApiKey = 'INSERT-YOUR-KEY-HERE'; |
| 55 | + |
| 56 | +==== Microsoft App ID ==== |
| 57 | + |
| 58 | +To be able to use the Microsoft Translation service, you need to [http://www.bing.com/developers/createapp.aspx get an App Id] and |
| 59 | +add it to your [[LocalSettings.php]] file AFTER the inclusion of the extension. |
| 60 | + |
| 61 | +# Microsoft App ID |
| 62 | +$egLiveTranslateMSAppId = 'INSERT-YOUR-ID-HERE'; |
| 63 | + |
| 64 | +=== Permissions === |
| 65 | + |
| 66 | +In order to edit the list of translation memories, you need the 'managetms' [[Permissions|permission]]. By default only sysops have this permission. |
| 67 | + |
| 68 | +<source lang="php"> |
| 69 | +$wgGroupPermissions['sysop']['managetms'] = true; |
| 70 | +</source> |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/INSTALL |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 71 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/RELEASE-NOTES |
— | — | @@ -0,0 +1,77 @@ |
| 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 1.1.1 === |
| 9 | +2011-06-22 |
| 10 | + |
| 11 | +* Fixed Internet Explorer compatibility issue. |
| 12 | +* Fixed bug in Microsoft transltion script for MW < 1.17. |
| 13 | +* Made Microsoft transltion script more robust by adding timeouts. |
| 14 | + |
| 15 | +=== Version 1.1 === |
| 16 | +2011-06-16 |
| 17 | + |
| 18 | +* Added support for the Microsoft Translation service. |
| 19 | +* Added support for comments in the LiveTranslate TMX format. |
| 20 | +* Added debug messages in the JavaScript that can be logged by setting $egLiveTranslateDebugJS to true. |
| 21 | + |
| 22 | +=== Version 1.0.1 === |
| 23 | +2011-05-27 |
| 24 | + |
| 25 | +* Added option (on by default) to store insignificant translations. |
| 26 | +* Tweaked the LTF parser to allow specifying a word that should never be translated. |
| 27 | + |
| 28 | +=== Version 1.0 === |
| 29 | +2011-05-26 |
| 30 | + |
| 31 | +* Fixed bug in the API. |
| 32 | +* Fixed some JavaScript issues causing problems for IE users. |
| 33 | +* Added missing right declaration. |
| 34 | + |
| 35 | +=== Version 0.6 === |
| 36 | +2011-04-21 |
| 37 | + |
| 38 | +* Added settings to specify per-namespace if the translation control should be shown or not. |
| 39 | +* Use of FormatJson::encode instead of json_encode for compatibility with PHP5 < 5.2. |
| 40 | + |
| 41 | +=== Version 0.5 === |
| 42 | +2011-01-16 |
| 43 | + |
| 44 | +* Modified the LT API to work with batches, so translation doesn't break for big translation memories. |
| 45 | +* Fixed regex escaping issue that caused translations to stop when encountering certain characters in special words. |
| 46 | + |
| 47 | +=== Version 0.4 === |
| 48 | +2011-01-14 |
| 49 | + |
| 50 | +* Added support for multiple translation memories. |
| 51 | +* Added Special:LiveTranslate to manage the translation memories that should be used. |
| 52 | +* Added support for remote translation memories. |
| 53 | +* Added support for the Translation Memory eXchange (TMX) format. |
| 54 | +* Added Google branding, which is required when using the Google Translate API. |
| 55 | +: https://code.google.com/apis/language/translate/v1/getting_started.html#getBranding |
| 56 | +* Improved translation memory insertion into the database. |
| 57 | +* Added better tracking of translation memory sizes and language counts. |
| 58 | + |
| 59 | +=== Version 0.3 === |
| 60 | +2011-01-07 |
| 61 | + |
| 62 | +* Added (partial) compatibility with IE8. Random errors still occur. Use a modern browser to prevent this. |
| 63 | +* Fixed issue with trim-prevention, causing |-signs to semi-randomly get inserted into translated text. |
| 64 | +* Only show the translation control when an API key is provided. |
| 65 | + |
| 66 | +=== Version 0.2 === |
| 67 | +2010-12-24 |
| 68 | + |
| 69 | +* Fixed installation compatibility issue with MW 1.16. |
| 70 | +* Fixed display of translation control to only happen on existing pages. |
| 71 | +* Fixed issues with inserting notranslatre tags into the page source. |
| 72 | + |
| 73 | +=== Version 0.1 === |
| 74 | +2010-12-22 |
| 75 | + |
| 76 | +* Added simple translation interface to the right top of articles. |
| 77 | +* Implemented translation via the Google Translate API. |
| 78 | +* Added dictionary for special words with synonyms support. |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/RELEASE-NOTES |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 79 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_TMParser.php |
— | — | @@ -0,0 +1,62 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Abstract base class for translation memory (TM) parsers. |
| 6 | + * |
| 7 | + * @since 0.4 |
| 8 | + * |
| 9 | + * @file LT_TMParser.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +abstract class LTTMParser { |
| 16 | + |
| 17 | + /** |
| 18 | + * Creates a new translation memory parser. |
| 19 | + * |
| 20 | + * @since 0.4 |
| 21 | + */ |
| 22 | + public function __construct() { |
| 23 | + |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * Parses the provided text to a LTTranslationMemory object. |
| 28 | + * |
| 29 | + * @since 0.4 |
| 30 | + * |
| 31 | + * @param string $text |
| 32 | + * |
| 33 | + * @return LTTranslationMemory |
| 34 | + */ |
| 35 | + public abstract function parse( $text ); |
| 36 | + |
| 37 | + /** |
| 38 | + * Retruns a new instance of a parser that implements LTTMParser and can parse |
| 39 | + * translation memories of the provided type. If none is found, an exception is thrown. |
| 40 | + * |
| 41 | + * @since 0.4 |
| 42 | + * |
| 43 | + * @param string $tmType |
| 44 | + * |
| 45 | + * @return LTTMParser |
| 46 | + */ |
| 47 | + public static function newFromType( $tmType ) { |
| 48 | + switch ( $tmType ) { |
| 49 | + case TMT_LTF : |
| 50 | + return new LTLTFParser(); |
| 51 | + break; |
| 52 | + case TMT_TMX : |
| 53 | + return new LTTMXParser(); |
| 54 | + break; |
| 55 | + case TMT_GCSV : |
| 56 | + return new LTGCSVParser(); |
| 57 | + break; |
| 58 | + default : |
| 59 | + throw new MWException( "There is no translation memory parser for translation memories of type '$tmType'." ); |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_TMParser.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 64 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_GCSVParser.php |
— | — | @@ -0,0 +1,24 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Parser for translation memory data in the Google CSV format (GCSV). |
| 6 | + * |
| 7 | + * @since 0.4 |
| 8 | + * |
| 9 | + * @file LT_GCSVParser.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class LTGCSVParser extends LTTMParser { |
| 16 | + |
| 17 | + /** |
| 18 | + * (non-PHPdoc) |
| 19 | + * @see LTTMParser::parse() |
| 20 | + */ |
| 21 | + public function parse( $text ) { |
| 22 | + return new LTTranslationMemory(); // TODO |
| 23 | + } |
| 24 | + |
| 25 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_GCSVParser.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 26 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/ext.lt.google.js |
— | — | @@ -0,0 +1,181 @@ |
| 2 | +/** |
| 3 | + * JavasSript for the Google translation functionality in the Live Translate extension. |
| 4 | + * @see http://www.mediawiki.org/wiki/Extension:Live_Translate |
| 5 | + * |
| 6 | + * @licence GNU GPL v3 or later |
| 7 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 8 | + */ |
| 9 | + |
| 10 | +google.load("language", "1"); |
| 11 | +google.setOnLoadCallback(function(){google.language.getBranding("googlebranding");}); |
| 12 | + |
| 13 | +(function( $ ){ window.translationService = function() { |
| 14 | + |
| 15 | + var self = this; |
| 16 | + |
| 17 | + this.done = function( targetLang ){}; |
| 18 | + |
| 19 | + this.runningJobs = 0; |
| 20 | + |
| 21 | + // This is to enable a hack to decode quotes. |
| 22 | + this.textAreaElement = document.createElement( 'textarea' ); |
| 23 | + |
| 24 | + /** |
| 25 | + * Determines a chunk to translate of an DOM elements contents and calls the Google Translate API. |
| 26 | + * Then calls itself if there is any remaining work to be done. |
| 27 | + * |
| 28 | + * @param {array} untranslatedsentences |
| 29 | + * @param {array} chunks |
| 30 | + * @param {integer} currentMaxSize |
| 31 | + * @param {string} sourceLang |
| 32 | + * @param {string} targetLang |
| 33 | + * @param {DOM element} element |
| 34 | + */ |
| 35 | + this.translateChunk = function( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ) { |
| 36 | + ltdebug( 'Google: Translating chunk' ); |
| 37 | + var remainingPart = false; |
| 38 | + var partToUse = false; |
| 39 | + var sentenceCount = 0; |
| 40 | + var currentLength = 0; |
| 41 | + |
| 42 | + // Find the scentances that can be put in the current chunk. |
| 43 | + for ( i in untranslatedsentences ) { |
| 44 | + sentenceCount++; |
| 45 | + |
| 46 | + if ( currentLength + untranslatedsentences[i].length < currentMaxSize ) { |
| 47 | + currentLength += untranslatedsentences[i].length; |
| 48 | + } |
| 49 | + else if ( untranslatedsentences[i].length > 0 ) { |
| 50 | + if ( currentLength == 0 ) { |
| 51 | + // If the first scentance is longer then the max chunk legth, split it. |
| 52 | + partToUse = untranslatedsentences[i].substr( 0, currentMaxSize - currentLength ); |
| 53 | + remainingPart = untranslatedsentences[i].substr( currentMaxSize - currentLength ); |
| 54 | + } |
| 55 | + |
| 56 | + break; |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + var chunk = ''; |
| 61 | + |
| 62 | + // Build the chunck. |
| 63 | + for ( i = 0; i < sentenceCount; i++ ) { |
| 64 | + var part = untranslatedsentences.shift(); |
| 65 | + |
| 66 | + if ( i != sentenceCount - 1 || partToUse === false ) { |
| 67 | + chunk += part; |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + // If there is a remaining part, re-add it to the scentances to translate list. |
| 72 | + if ( remainingPart !== false ) { |
| 73 | + untranslatedsentences.unshift( remainingPart ); |
| 74 | + } |
| 75 | + |
| 76 | + // If there is a partial scentance, add it to the chunk. |
| 77 | + if ( partToUse !== false ) { |
| 78 | + chunk += partToUse; |
| 79 | + } |
| 80 | + |
| 81 | + // If the lenght is 0, the element has been translated. |
| 82 | + if ( chunk.length == 0 ) { |
| 83 | + this.handleTranslationCompletion( targetLang ); |
| 84 | + return; |
| 85 | + } |
| 86 | + |
| 87 | + // Keep track of leading and tailing spaces, as they often get modified by the GT API. |
| 88 | + var leadingSpace = chunk.substr( 0, 1 ) == ' ' ? ' ' : ''; |
| 89 | + var tailingSpace = ( chunk.length > 1 && chunk.substr( chunk.length - 1, 1 ) == ' ' ) ? ' ' : ''; |
| 90 | + |
| 91 | + google.language.translate( |
| 92 | + jQuery.trim( chunk ), // Trim, so the result does not contain preceding or tailing spaces. |
| 93 | + sourceLang, |
| 94 | + targetLang, |
| 95 | + function(result) { |
| 96 | + ltdebug( 'Google: Translated chunk' ); |
| 97 | + |
| 98 | + if ( result.translation ) { |
| 99 | + chunks.push( leadingSpace + result.translation + tailingSpace ); |
| 100 | + } |
| 101 | + else { |
| 102 | + // If the translation failed, keep the original text. |
| 103 | + chunks.push( chunk ); |
| 104 | + } |
| 105 | + |
| 106 | + if ( untranslatedsentences.length == 0 ) { |
| 107 | + // If the current chunk was smaller then the max size, node translation is complete, so update text. |
| 108 | + self.textAreaElement.innerHTML = chunks.join( '' ); // This is a hack to decode quotes. |
| 109 | + element.replaceData( 0, element.length, self.textAreaElement.value ); |
| 110 | + self.handleTranslationCompletion( targetLang ); |
| 111 | + } |
| 112 | + else { |
| 113 | + // If there is more work to do, move on to the next chunk. |
| 114 | + self.translateChunk( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ); |
| 115 | + } |
| 116 | + } |
| 117 | + ); |
| 118 | + } |
| 119 | + |
| 120 | + /** |
| 121 | + * Translates a single DOM element using Google Translate. |
| 122 | + * Loops through child elements and recursively calls itself to translate these. |
| 123 | + * |
| 124 | + * @param {jQuery} element |
| 125 | + * @param {string} sourceLang |
| 126 | + * @param {string} targetLang |
| 127 | + */ |
| 128 | + this.translateElement = function( element, sourceLang, targetLang ) { |
| 129 | + ltdebug( 'Google: Translating element' ); |
| 130 | + this.runningJobs++; |
| 131 | + |
| 132 | + var maxChunkLength = 500; |
| 133 | + |
| 134 | + element.contents().each( function() { |
| 135 | + ltdebug( 'Google: Element conent item' ); |
| 136 | + |
| 137 | + // If it's a text node, then translate it. |
| 138 | + if ( this.nodeType == 3 && typeof this.data === 'string' && $.trim( this.data ).length > 0 ) { |
| 139 | + ltdebug( 'Google: Found content node' ); |
| 140 | + |
| 141 | + self.runningJobs++; |
| 142 | + self.translateChunk( |
| 143 | + this.data.split( new RegExp( "([.!?])(?=\\s+|$)", "gi" ) ), // "(\\S.+?[.!?])(?=\\s+|$)" |
| 144 | + [], |
| 145 | + maxChunkLength, |
| 146 | + sourceLang, |
| 147 | + targetLang, |
| 148 | + this |
| 149 | + ); |
| 150 | + } |
| 151 | + // If it's an html element, check to see if it should be ignored, and if not, apply function again. |
| 152 | + else if ( this.nodeType != 3 |
| 153 | + && $.inArray( $( this ).attr( 'id' ), [ 'siteSub', 'jump-to-nav' ] ) == -1 |
| 154 | + && !$( this ).hasClass( 'notranslate' ) && !$( this ).hasClass( 'printfooter' ) |
| 155 | + && $( this ).text().length > 0 ) { |
| 156 | + |
| 157 | + ltdebug( 'Google: Found child node' ); |
| 158 | + self.translateElement( $( this ), sourceLang, targetLang ); |
| 159 | + } |
| 160 | + else { |
| 161 | + ltdebug( 'Google: Found ignore node' ); |
| 162 | + } |
| 163 | + } ); |
| 164 | + |
| 165 | + this.handleTranslationCompletion( targetLang ); |
| 166 | + } |
| 167 | + |
| 168 | + /** |
| 169 | + * Should be called every time a DOM element has been translated. |
| 170 | + * By use of the runningJobs var, completion of the translation process is detected, |
| 171 | + * and further handled by this function. |
| 172 | + * |
| 173 | + * @param {string} targetLang |
| 174 | + */ |
| 175 | + this.handleTranslationCompletion = function( targetLang ) { |
| 176 | + if ( !--this.runningJobs ) { |
| 177 | + ltdebug( 'Google: translation process done' ); |
| 178 | + this.done( targetLang ); |
| 179 | + } |
| 180 | + } |
| 181 | + |
| 182 | +}; })( jQuery ); |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/ext.lt.google.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 183 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_TMUnit.php |
— | — | @@ -0,0 +1,143 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class describing a single translation memory unit. |
| 6 | + * |
| 7 | + * @since 0.4 |
| 8 | + * |
| 9 | + * @file LT_TMUnit.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class LTTMUnit { |
| 16 | + |
| 17 | + /** |
| 18 | + * List of language variants of the translation memory unit. |
| 19 | + * |
| 20 | + * language code => array( primary translation [, synonym [, ect]] ) |
| 21 | + * |
| 22 | + * @since 0.4 |
| 23 | + * |
| 24 | + * @var array |
| 25 | + */ |
| 26 | + protected $variants = array(); |
| 27 | + |
| 28 | + /** |
| 29 | + * Creates a new translation memory unit. |
| 30 | + * |
| 31 | + * @since 0.4 |
| 32 | + * |
| 33 | + * @param array $variants |
| 34 | + */ |
| 35 | + public function __construct( array $variants = array() ) { |
| 36 | + $this->addVariants( $variants ); |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * Returns the list of language variants of the translation memory unit. |
| 41 | + * |
| 42 | + * @since 0.4 |
| 43 | + * |
| 44 | + * @var array: language code => array( primary translation [, synonym [, ect]] ) |
| 45 | + */ |
| 46 | + public function getVariants() { |
| 47 | + return $this->variants; |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Adds the translation (and optional synonyms) of the unit in a single language. |
| 52 | + * |
| 53 | + * @since 0.4 |
| 54 | + * |
| 55 | + * @param string $language |
| 56 | + * @param string $translation |
| 57 | + * @param array $synonyms |
| 58 | + */ |
| 59 | + public function addVariant( $language, $translation, array $synonyms = array() ) { |
| 60 | + $this->variants[$language] = array_merge( array( $translation ), $synonyms ); |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * Adds a list of translations to the translation memory unit. |
| 65 | + * |
| 66 | + * @since 0.4 |
| 67 | + * |
| 68 | + * @param array $variants language code => array( primary translation [, synonym [, ect]] ) |
| 69 | + */ |
| 70 | + public function addVariants( array $variants ) { |
| 71 | + foreach ( $variants as $language => $variant ) { |
| 72 | + $variant = (array)$variant; // Do not require an array, to simplify notation when there are no synonyms. |
| 73 | + $primaryTranslation = array_shift( $variant ); |
| 74 | + $this->addVariant( $language, $primaryTranslation, $variant ); |
| 75 | + } |
| 76 | + } |
| 77 | + |
| 78 | + /** |
| 79 | + * Returns if the translation unit has any variants. If not, it can probably be ignored. |
| 80 | + * |
| 81 | + * @since 0.4 |
| 82 | + * |
| 83 | + * @return boolean |
| 84 | + */ |
| 85 | + public function hasVariants() { |
| 86 | + return count( $this->variants ) > 0; |
| 87 | + } |
| 88 | + |
| 89 | + /** |
| 90 | + * Returns if the translation unit has any significant value. This means it has at least 2 |
| 91 | + * variants with different values. |
| 92 | + * |
| 93 | + * @since 0.4 |
| 94 | + * |
| 95 | + * @return boolean |
| 96 | + */ |
| 97 | + public function isSignificant() { |
| 98 | + return count( $this->variants ) > 1 && $this->hasVariantDifferences(); |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * Returns if the translation unit has a certain minimal amount (default: 1) of |
| 103 | + * differences in values in it's variants. |
| 104 | + * |
| 105 | + * @since 0.4 |
| 106 | + * |
| 107 | + * @return boolean |
| 108 | + */ |
| 109 | + public function hasVariantDifferences( $minAmount = 1 ) { |
| 110 | + $amount = -1; // The first unknown value is not a difference. |
| 111 | + $knownValues = array(); |
| 112 | + |
| 113 | + foreach ( $this->variants as $variant ) { |
| 114 | + // If the value is not known yet, it's a difference. |
| 115 | + if ( !in_array( $variant[0], $knownValues ) ) { |
| 116 | + $knownValues[] = $variant[0]; |
| 117 | + $amount++; |
| 118 | + } |
| 119 | + // If there are synonyms, just assume it's different. |
| 120 | + // This might not be the case, but no full accuracy is required. |
| 121 | + elseif ( count( $variant ) > 1 ) { |
| 122 | + $amount++; |
| 123 | + } |
| 124 | + |
| 125 | + if ( $amount >= $minAmount ) { |
| 126 | + return true; |
| 127 | + } |
| 128 | + } |
| 129 | + |
| 130 | + return false; |
| 131 | + } |
| 132 | + |
| 133 | + /** |
| 134 | + * Returns the amount of languages (variants). |
| 135 | + * |
| 136 | + * @since 0.4 |
| 137 | + * |
| 138 | + * @return integer |
| 139 | + */ |
| 140 | + public function getLanguageAmount() { |
| 141 | + return count( $this->variants ); |
| 142 | + } |
| 143 | + |
| 144 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_TMUnit.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 145 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_LTFParser.php |
— | — | @@ -0,0 +1,68 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Parser for custom Live Translate translation memory Format (LFT) data. |
| 6 | + * |
| 7 | + * @since 0.4 |
| 8 | + * |
| 9 | + * @file LT_LTFParser.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class LTLTFParser extends LTTMParser { |
| 16 | + |
| 17 | + /** |
| 18 | + * (non-PHPdoc) |
| 19 | + * @see LTTMParser::parse() |
| 20 | + */ |
| 21 | + public function parse( $text ) { |
| 22 | + $tm = new LTTranslationMemory(); |
| 23 | + |
| 24 | + $translationSets = array(); |
| 25 | + |
| 26 | + $text = preg_replace( '/\\<!--([^(--\\>)]*)--\\>/', '', $text ); |
| 27 | + $lines = explode( "\n", $text ); |
| 28 | + |
| 29 | + while ( true ) { |
| 30 | + $languages = array_shift( $lines ); |
| 31 | + |
| 32 | + if ( trim( $languages ) != '' ) { |
| 33 | + break; |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + $languages = array_map( 'trim', explode( ',', $languages ) ); |
| 38 | + |
| 39 | + foreach ( $lines as $line ) { |
| 40 | + if ( trim( $line ) == '' ) { |
| 41 | + continue; |
| 42 | + } |
| 43 | + |
| 44 | + $values = array_map( 'trim', explode( ',', $line ) ); |
| 45 | + $tu = new LTTMUnit(); |
| 46 | + |
| 47 | + // If there is only one value, interpret it as "should never be translated", and add it for all languages. |
| 48 | + if ( count( $values ) == 1 ) { |
| 49 | + foreach ( $languages as $language ) { |
| 50 | + // Add the translation (or translations) (value, array) of the word in the language (key). |
| 51 | + $tu->addVariants( array( $language => array_map( 'trim', explode( '|', $values[0] ) ) ) ); |
| 52 | + } |
| 53 | + } |
| 54 | + else { |
| 55 | + foreach ( $languages as $nr => $language ) { |
| 56 | + if ( array_key_exists( $nr, $values ) ) { |
| 57 | + // Add the translation (or translations) (value, array) of the word in the language (key). |
| 58 | + $tu->addVariants( array( $language => array_map( 'trim', explode( '|', $values[$nr] ) ) ) ); |
| 59 | + } |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + $tm->addTranslationUnit( $tu ); |
| 64 | + } |
| 65 | + |
| 66 | + return $tm; |
| 67 | + } |
| 68 | + |
| 69 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_LTFParser.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 70 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/ext.livetranslate.js |
— | — | @@ -0,0 +1,245 @@ |
| 2 | +/** |
| 3 | + * JavasSript for the Live Translate extension. |
| 4 | + * @see http://www.mediawiki.org/wiki/Extension:Live_Translate |
| 5 | + * |
| 6 | + * @licence GNU GPL v3 or later |
| 7 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 8 | + */ |
| 9 | + |
| 10 | +(function($) { $( document ).ready( function() { |
| 11 | + |
| 12 | + /* |
| 13 | + * jQuery replaceText - v1.1 - 11/21/2009 |
| 14 | + * http://benalman.com/projects/jquery-replacetext-plugin/ |
| 15 | + * |
| 16 | + * Copyright (c) 2009 "Cowboy" Ben Alman |
| 17 | + * Dual licensed under the MIT and GPL licenses. |
| 18 | + * http://benalman.com/about/license/ |
| 19 | + */ |
| 20 | + $.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()})} |
| 21 | + |
| 22 | + window.ltdebug = function( message ) { |
| 23 | + if ( window.ltDebugMessages ) { |
| 24 | + if ( typeof console === 'undefined' ) { |
| 25 | + document.title = 'Live Translate: ' + message; |
| 26 | + } |
| 27 | + else { |
| 28 | + console.log( 'Live Translate: ' + message ); |
| 29 | + } |
| 30 | + } |
| 31 | + }; |
| 32 | + |
| 33 | + var currentLang = $( '#livetranslatediv' ).attr( 'sourcelang' ); |
| 34 | + |
| 35 | + // For the "show original" feature. |
| 36 | + var originalHtml = false; |
| 37 | + |
| 38 | + window.textAreaElement = document.createElement( 'textarea' ); |
| 39 | + |
| 40 | + // Compatibility with pre-RL code. |
| 41 | + // Messages will have been loaded into wgPushMessages. |
| 42 | + if ( typeof mediaWiki === 'undefined' ) { |
| 43 | + mediaWiki = new Object(); |
| 44 | + |
| 45 | + mediaWiki.msg = function() { |
| 46 | + message = window.wgLTEMessages[arguments[0]]; |
| 47 | + |
| 48 | + for ( var i = arguments.length - 1; i > 0; i-- ) { |
| 49 | + message = message.replace( '$' + i, arguments[i] ); |
| 50 | + } |
| 51 | + |
| 52 | + return message; |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + /** |
| 57 | + * Disables the translation button and then either kicks of insertion of |
| 58 | + * notranslate spans around special words, or when this already happened, |
| 59 | + * the actual translation process. |
| 60 | + */ |
| 61 | + setupTranslationFeatures = function() { |
| 62 | + $( this ).attr( "disabled", true ).text( mediaWiki.msg( 'livetranslate-button-translating' ) ); |
| 63 | + |
| 64 | + if ( originalHtml === false ) { |
| 65 | + obtainAndInsertTranslations( -1 ); |
| 66 | + } |
| 67 | + else { |
| 68 | + initiateTranslating(); |
| 69 | + } |
| 70 | + } |
| 71 | + |
| 72 | + /** |
| 73 | + * Queries a batch of special words in the source language, finds them in the page, |
| 74 | + * and wraps the into notranslate spans. If there are no more words, the translation |
| 75 | + * process is initaiated, otherwise the function calls itself again. |
| 76 | + */ |
| 77 | + function obtainAndInsertTranslations( offset ) { |
| 78 | + var requestArgs = { |
| 79 | + 'action': 'query', |
| 80 | + 'format': 'json', |
| 81 | + 'list': 'livetranslate', |
| 82 | + 'ltlanguage': currentLang |
| 83 | + }; |
| 84 | + |
| 85 | + if ( offset > 0 ) { |
| 86 | + requestArgs['ltcontinue'] = offset; |
| 87 | + } |
| 88 | + |
| 89 | + $.getJSON( |
| 90 | + wgScriptPath + '/api.php', |
| 91 | + requestArgs, |
| 92 | + function( data ) { |
| 93 | + if ( data.words ) { |
| 94 | + insertNoTranslateTags( data.words ); |
| 95 | + } |
| 96 | + else if ( data.error && data.error.info ) { |
| 97 | + alert( data.error.info ); |
| 98 | + } |
| 99 | + else { |
| 100 | + for ( i in data ) { |
| 101 | + alert( mediaWiki.msg( 'livetranslate-dictionary-error' ) ); |
| 102 | + break; |
| 103 | + } |
| 104 | + } |
| 105 | + |
| 106 | + originalHtml = $( '#bodyContent' ).html(); |
| 107 | + |
| 108 | + if ( data['query-continue'] ) { |
| 109 | + obtainAndInsertTranslations( data['query-continue'].livetranslate.ltcontinue ); |
| 110 | + } |
| 111 | + else { |
| 112 | + initiateTranslating(); |
| 113 | + } |
| 114 | + } |
| 115 | + ); |
| 116 | + } |
| 117 | + |
| 118 | + /** |
| 119 | + * Initiates the translation process. |
| 120 | + * First all special words are found and send to the local API, |
| 121 | + * and then replaced by their translation in the response. Then |
| 122 | + * the Google Translate translation is initiated. |
| 123 | + */ |
| 124 | + function initiateTranslating() { |
| 125 | + var words = getSpecialWords(); |
| 126 | + var newLang = $( '#livetranslatelang' ).val(); |
| 127 | + |
| 128 | + if ( words.length == 0 ) { |
| 129 | + initiateRemoteTranslating( currentLang, newLang ); |
| 130 | + } |
| 131 | + else { |
| 132 | + $.getJSON( |
| 133 | + wgScriptPath + '/api.php', |
| 134 | + { |
| 135 | + 'action': 'livetranslate', |
| 136 | + 'format': 'json', |
| 137 | + 'from': currentLang, |
| 138 | + 'to': newLang, |
| 139 | + 'words': words.join( '|' ) |
| 140 | + }, |
| 141 | + function( data ) { |
| 142 | + if ( data.translations ) { |
| 143 | + replaceSpecialWords( data.translations ); |
| 144 | + } |
| 145 | + initiateRemoteTranslating( currentLang, newLang ); |
| 146 | + } |
| 147 | + ); |
| 148 | + } |
| 149 | + } |
| 150 | + |
| 151 | + /** |
| 152 | + * Shows the original page content, simply by setting the html to a stored copy of the original. |
| 153 | + * Also re-binds the jQuery events, as they get lost when doing the html replace. |
| 154 | + */ |
| 155 | + showOriginal = function() { |
| 156 | + currentLang = window.sourceLang; |
| 157 | + $( '#bodyContent' ).html( originalHtml ); |
| 158 | + $( '#livetranslatebutton' ).attr( "disabled", false ).text( mediaWiki.msg( 'livetranslate-button-translate' ) ); |
| 159 | + $( '#livetranslatebutton' ).click( setupTranslationFeatures ); |
| 160 | + $( '#ltrevertbutton' ).click( showOriginal ); |
| 161 | + } |
| 162 | + |
| 163 | + // Initial binding of the button click events. |
| 164 | + $( '#livetranslatebutton' ).click( setupTranslationFeatures ); |
| 165 | + $( '#ltrevertbutton' ).click( showOriginal ); |
| 166 | + |
| 167 | + /** |
| 168 | + * Regex text escaping function. |
| 169 | + * Borrowed from http://simonwillison.net/2006/Jan/20/escape/ |
| 170 | + */ |
| 171 | + RegExp.escape = function(text) { |
| 172 | + if (!arguments.callee.sRE) { |
| 173 | + var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\' ]; |
| 174 | + arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' ); |
| 175 | + } |
| 176 | + return text.replace(arguments.callee.sRE, '\\$1'); |
| 177 | + } |
| 178 | + |
| 179 | + /** |
| 180 | + * Inserts notranslate spans around the words specified in the passed array in the page content. |
| 181 | + * |
| 182 | + * @param {Array} words |
| 183 | + */ |
| 184 | + function insertNoTranslateTags( words ) { |
| 185 | + for ( i in words ) { |
| 186 | + $( '#bodyContent *' ).replaceText( |
| 187 | + new RegExp( "(\\W)*" + RegExp.escape( words[i] ) + "(\\W)*", "g" ), |
| 188 | + function( str ) { |
| 189 | + return '<span class="notranslate">' + str + '</span>'; |
| 190 | + } |
| 191 | + ); |
| 192 | + } |
| 193 | + } |
| 194 | + |
| 195 | + /** |
| 196 | + * Finds the special words in the page contents by getting the contents of all |
| 197 | + * notranslate spans and pushing them onto an array. |
| 198 | + * |
| 199 | + * @returns {Array} |
| 200 | + */ |
| 201 | + function getSpecialWords() { |
| 202 | + var words = []; |
| 203 | + |
| 204 | + $.each($( 'span.notranslate' ), function( i, v ) { |
| 205 | + words.push( $(v).text() ); |
| 206 | + }); |
| 207 | + |
| 208 | + return words; |
| 209 | + } |
| 210 | + |
| 211 | + /** |
| 212 | + * Replaced the special words in the page content by looping over them, |
| 213 | + * and checking if there is a matching translation in the provided object. |
| 214 | + * |
| 215 | + * @param {object} translations |
| 216 | + */ |
| 217 | + function replaceSpecialWords( translations ) { |
| 218 | + $.each($("span.notranslate"), function(i,v) { |
| 219 | + var currentText = $(v).text(); |
| 220 | + if ( translations[currentText] ) { |
| 221 | + $(v).text( translations[currentText] ); |
| 222 | + } |
| 223 | + }); |
| 224 | + } |
| 225 | + |
| 226 | + /** |
| 227 | + * Initiates the remote translation process. |
| 228 | + * |
| 229 | + * @param {string} sourceLang |
| 230 | + * @param {string} targetLang |
| 231 | + */ |
| 232 | + function initiateRemoteTranslating( sourceLang, targetLang ) { |
| 233 | + var translator = new translationService(); |
| 234 | + translator.done = handleTranslationCompletion; |
| 235 | + ltdebug( 'Initiating remote translation' ); |
| 236 | + translator.translateElement( $( '#bodyContent' ), sourceLang, targetLang ); |
| 237 | + } |
| 238 | + |
| 239 | + function handleTranslationCompletion( targetLang ) { |
| 240 | + ltdebug( 'Remote translation completed' ); |
| 241 | + currentLang = targetLang; |
| 242 | + $( '#livetranslatebutton' ).attr( "disabled", false ).text( mediaWiki.msg( 'livetranslate-button-translate' ) ); |
| 243 | + $( '#ltrevertbutton' ).css( 'display', 'inline' ); |
| 244 | + } |
| 245 | + |
| 246 | +} ); })(jQuery); |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/ext.livetranslate.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 247 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/ext.lt.ms.js |
— | — | @@ -0,0 +1,234 @@ |
| 2 | +/** |
| 3 | + * JavasSript for the Microsoft translation functionality in the Live Translate extension. |
| 4 | + * @see http://www.mediawiki.org/wiki/Extension:Live_Translate |
| 5 | + * |
| 6 | + * @licence GNU GPL v3 or later |
| 7 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 8 | + */ |
| 9 | + |
| 10 | +(function( $ ){ window.translationService = function() { |
| 11 | + |
| 12 | + var self = this; |
| 13 | + |
| 14 | + this.done = function( targetLang ){}; |
| 15 | + |
| 16 | + this.runningJobs = 0; |
| 17 | + this.checkingForIdle = false; |
| 18 | + this.lastCompletion; |
| 19 | +// window.fooz = 0; |
| 20 | + |
| 21 | + /** |
| 22 | + * Determines a chunk to translate of an DOM elements contents and calls the Microsoft Translate API. |
| 23 | + * Then calls itself if there is any remaining work to be done. |
| 24 | + * |
| 25 | + * @param {array} untranslatedsentences |
| 26 | + * @param {array} chunks |
| 27 | + * @param {integer} currentMaxSize |
| 28 | + * @param {string} sourceLang |
| 29 | + * @param {string} targetLang |
| 30 | + * @param {DOM element} element |
| 31 | + */ |
| 32 | + this.translateChunk = function( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ) { |
| 33 | + ltdebug( 'MS: Translating chunk' ); |
| 34 | + var remainingPart = false; |
| 35 | + var partToUse = false; |
| 36 | + var sentenceCount = 0; |
| 37 | + var currentLength = 0; |
| 38 | + |
| 39 | + // Find the scentances that can be put in the current chunk. |
| 40 | + for ( i in untranslatedsentences ) { |
| 41 | + sentenceCount++; |
| 42 | + |
| 43 | + if ( currentLength + untranslatedsentences[i].length < currentMaxSize ) { |
| 44 | + currentLength += untranslatedsentences[i].length; |
| 45 | + } |
| 46 | + else if ( untranslatedsentences[i].length > 0 ) { |
| 47 | + if ( currentLength == 0 ) { |
| 48 | + // If the first scentance is longer then the max chunk legth, split it. |
| 49 | + partToUse = untranslatedsentences[i].substr( 0, currentMaxSize - currentLength ); |
| 50 | + remainingPart = untranslatedsentences[i].substr( currentMaxSize - currentLength ); |
| 51 | + } |
| 52 | + |
| 53 | + break; |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + var chunk = ''; |
| 58 | + |
| 59 | + // Build the chunck. |
| 60 | + for ( i = 0; i < sentenceCount; i++ ) { |
| 61 | + var part = untranslatedsentences.shift(); |
| 62 | + |
| 63 | + if ( i != sentenceCount - 1 || partToUse === false ) { |
| 64 | + chunk += part; |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + // If there is a remaining part, re-add it to the scentances to translate list. |
| 69 | + if ( remainingPart !== false ) { |
| 70 | + untranslatedsentences.unshift( remainingPart ); |
| 71 | + } |
| 72 | + |
| 73 | + // If there is a partial scentance, add it to the chunk. |
| 74 | + if ( partToUse !== false ) { |
| 75 | + chunk += partToUse; |
| 76 | + } |
| 77 | + |
| 78 | + // If the lenght is 0, the element has been translated. |
| 79 | + if ( chunk.length == 0 ) { |
| 80 | + this.handleTranslationCompletion( targetLang ); |
| 81 | + return; |
| 82 | + } |
| 83 | + |
| 84 | + // Keep track of leading and tailing spaces, as they often get modified by the GT API. |
| 85 | + var leadingSpace = chunk.substr( 0, 1 ) == ' ' ? ' ' : ''; |
| 86 | + var tailingSpace = ( chunk.length > 1 && chunk.substr( chunk.length - 1, 1 ) == ' ' ) ? ' ' : ''; |
| 87 | + |
| 88 | + var chunckTranslationDone = function( translation ) { |
| 89 | + ltdebug( 'MS: Translated chunk' ); |
| 90 | + |
| 91 | + if ( translation ) { |
| 92 | + chunks.push( leadingSpace + translation + tailingSpace ); |
| 93 | + } |
| 94 | + else { |
| 95 | + // If the translation failed, keep the original text. |
| 96 | + chunks.push( chunk ); |
| 97 | + } |
| 98 | + |
| 99 | + if ( untranslatedsentences.length == 0 ) { |
| 100 | + // If the current chunk was smaller then the max size, node translation is complete, so update text. |
| 101 | + window.textAreaElement.innerHTML = chunks.join( '' ); // This is a hack to decode quotes. |
| 102 | + element.replaceData( 0, element.length, window.textAreaElement.value ); |
| 103 | + |
| 104 | + ltdebug( 'MS: Translated element' ); |
| 105 | + self.handleTranslationCompletion( targetLang ); |
| 106 | + } |
| 107 | + else { |
| 108 | + // If there is more work to do, move on to the next chunk. |
| 109 | + self.translateChunk( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ); |
| 110 | + } |
| 111 | + }; |
| 112 | + |
| 113 | + $.getJSON( |
| 114 | + 'http://api.microsofttranslator.com/V2/Ajax.svc/Translate?oncomplete=?', |
| 115 | + { |
| 116 | + 'appId': window.ltMsAppId, |
| 117 | + 'from': sourceLang, |
| 118 | + 'to': targetLang, |
| 119 | + 'text': $.trim( chunk ) // Trim, so the result does not contain preceding or tailing spaces. |
| 120 | + }, |
| 121 | + chunckTranslationDone |
| 122 | + ); |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * Translates a single DOM element using Microsoft Translate. |
| 127 | + * Loops through child elements and recursively calls itself to translate these. |
| 128 | + * |
| 129 | + * @param {jQuery} element |
| 130 | + * @param {string} sourceLang |
| 131 | + * @param {string} targetLang |
| 132 | + */ |
| 133 | + this.translateElement = function( element, sourceLang, targetLang ) { |
| 134 | + ltdebug( 'MS: Translating element' ); |
| 135 | + this.runningJobs++; |
| 136 | + |
| 137 | + var maxChunkLength = 500; |
| 138 | + |
| 139 | + element.contents().each( function() { |
| 140 | + ltdebug( 'MS: Element conent item' ); |
| 141 | + |
| 142 | + // If it's a text node, then translate it. |
| 143 | + if ( this.nodeType == 3 && typeof this.data === 'string' && $.trim( this.data ).length > 0 ) { |
| 144 | + ltdebug( 'MS: Found content node' ); |
| 145 | + |
| 146 | + self.runningJobs++; |
| 147 | + |
| 148 | +// if ( window.fooz < 7 ) { |
| 149 | +// window.fooz++; |
| 150 | +// if ( window.fooz > 6 ) { |
| 151 | +// alert( this.data + "\n---------------" ); |
| 152 | +// var partz = this.data.split( new RegExp( "[.!?](?=\\s+|$)", "gi" ) ); |
| 153 | +// for ( i in partz ) { |
| 154 | +// alert( partz[i] ); |
| 155 | +// } |
| 156 | +// } |
| 157 | +// } |
| 158 | + |
| 159 | + self.translateChunk( |
| 160 | + this.data.split( new RegExp( "([.!?])(?=\\s+|$)", "gi" ) ), // "(\\S.+?[.!?])(?=\\s+|$)" |
| 161 | + [], |
| 162 | + maxChunkLength, |
| 163 | + sourceLang, |
| 164 | + targetLang, |
| 165 | + this |
| 166 | + ); |
| 167 | + } |
| 168 | + // If it's an html element, check to see if it should be ignored, and if not, apply function again. |
| 169 | + else if ( this.nodeType != 3 |
| 170 | + && $.inArray( $( this ).attr( 'id' ), [ 'siteSub', 'jump-to-nav' ] ) == -1 |
| 171 | + && !$( this ).hasClass( 'notranslate' ) && !$( this ).hasClass( 'printfooter' ) |
| 172 | + && $( this ).text().length > 0 ) { |
| 173 | + |
| 174 | + ltdebug( 'MS: Found child node' ); |
| 175 | + self.translateElement( $( this ), sourceLang, targetLang ); |
| 176 | + } |
| 177 | + else { |
| 178 | + ltdebug( 'MS: Found ignore node' ); |
| 179 | + } |
| 180 | + } ); |
| 181 | + |
| 182 | + this.handleTranslationCompletion( targetLang ); |
| 183 | + } |
| 184 | + |
| 185 | + this.invokeDone = function( targetLang ) { |
| 186 | + ltdebug( 'MS: translation process done' ); |
| 187 | + ltdebug( this.runningJobs ); |
| 188 | + this.runningJobs = 0; |
| 189 | + this.done( targetLang ); |
| 190 | + } |
| 191 | + |
| 192 | + this.checkForIdleness = function( targetLang, hits ) { |
| 193 | + ltdebug( 'MS: checkForIdleness' ); |
| 194 | + ltdebug( 'MS: last + 250: ' + ( this.lastCompletion + 250 ) ); |
| 195 | + ltdebug( 'MS: now: ' + (new Date()).getTime() ); |
| 196 | + |
| 197 | + if ( this.lastCompletion + 250 < (new Date()).getTime() ) { |
| 198 | + hits++; |
| 199 | + } |
| 200 | + else { |
| 201 | + hits = 0; |
| 202 | + } |
| 203 | + |
| 204 | + if ( hits > 4 ) { |
| 205 | + this.invokeDone( targetLang ); |
| 206 | + } |
| 207 | + else if ( this.runningJobs > 0 ) { |
| 208 | + setTimeout( function() { self.checkForIdleness( targetLang, hits ); }, 250 ); |
| 209 | + } |
| 210 | + } |
| 211 | + |
| 212 | + /** |
| 213 | + * Should be called every time a DOM element has been translated. |
| 214 | + * By use of the runningJobs var, completion of the translation process is detected, |
| 215 | + * and further handled by this function. |
| 216 | + * |
| 217 | + * @param {string} targetLang |
| 218 | + */ |
| 219 | + this.handleTranslationCompletion = function( targetLang ) { |
| 220 | + if ( !this.checkingForIdle && this.runningJobs > 1 && this.runningJobs < 20 ) { |
| 221 | + this.checkingForIdle = true; |
| 222 | + setTimeout( function() { self.checkForIdleness( targetLang, 0 ); }, 250 ); |
| 223 | + } |
| 224 | + |
| 225 | + if ( this.checkingForIdle ) { |
| 226 | + this.lastCompletion = (new Date()).getTime(); |
| 227 | + } |
| 228 | + |
| 229 | + if ( !--this.runningJobs ) { |
| 230 | + this.invokeDone( targetLang ); |
| 231 | + } |
| 232 | + } |
| 233 | + |
| 234 | + |
| 235 | +}; })( jQuery ); |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/ext.lt.ms.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 236 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_TMXParser.php |
— | — | @@ -0,0 +1,195 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Parser for translation memory exchange (TXM) data. |
| 6 | + * |
| 7 | + * @since 0.4 |
| 8 | + * |
| 9 | + * @file LT_TMXParser.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + * @author Nicola Asuni < http://evolt.org/node/60511 > |
| 15 | + */ |
| 16 | +class LTTMXParser extends LTTMParser { |
| 17 | + |
| 18 | + /** |
| 19 | + * XML parser object. |
| 20 | + * |
| 21 | + * @since 0.4 |
| 22 | + * |
| 23 | + * @var resource |
| 24 | + */ |
| 25 | + protected $parser; |
| 26 | + |
| 27 | + /** |
| 28 | + * The translation memory the parser will store translations in before returning them. |
| 29 | + * |
| 30 | + * @since 0.4 |
| 31 | + * |
| 32 | + * @var LTTranslationMemory |
| 33 | + */ |
| 34 | + protected $tm; |
| 35 | + |
| 36 | + /** |
| 37 | + * The current translation unit. |
| 38 | + * |
| 39 | + * @since 0.4 |
| 40 | + * |
| 41 | + * @var LTTMUnit |
| 42 | + */ |
| 43 | + protected $tu; |
| 44 | + |
| 45 | + /** |
| 46 | + * The language of the current translation unit variant (tuv) node. |
| 47 | + * |
| 48 | + * @since 0.4 |
| 49 | + * |
| 50 | + * @var string |
| 51 | + */ |
| 52 | + protected $currentLanguage; |
| 53 | + |
| 54 | + /** |
| 55 | + * A string to build up translations when a single variant contains multiple segments. |
| 56 | + * |
| 57 | + * @since 0.4 |
| 58 | + * |
| 59 | + * @var string |
| 60 | + */ |
| 61 | + protected $currentTranslation; |
| 62 | + |
| 63 | + /** |
| 64 | + * Boolean to keep track of if the XML parser is inside a segment node. |
| 65 | + * |
| 66 | + * @since 0.4 |
| 67 | + * |
| 68 | + * @var boolean |
| 69 | + */ |
| 70 | + protected $insideSegment; |
| 71 | + |
| 72 | + /** |
| 73 | + * Boolean to keep track of if the XML parser is inside a node that should be ignored. |
| 74 | + * |
| 75 | + * @since 0.4 |
| 76 | + * |
| 77 | + * @var boolean |
| 78 | + */ |
| 79 | + protected $insideIgnoreNode; |
| 80 | + |
| 81 | + /** |
| 82 | + * Constructor. |
| 83 | + * |
| 84 | + * @since 0.4 |
| 85 | + */ |
| 86 | + public function __construct() { |
| 87 | + parent::__construct(); |
| 88 | + |
| 89 | + $this->parser = xml_parser_create(); |
| 90 | + |
| 91 | + xml_parser_set_option( $this->parser, XML_OPTION_CASE_FOLDING, 0 ); |
| 92 | + |
| 93 | + xml_set_object( $this->parser, $this ); |
| 94 | + xml_set_element_handler( $this->parser, "startElementHandler", "endElementHandler" ); |
| 95 | + xml_set_character_data_handler( $this->parser, "segmentContentHandler" ); |
| 96 | + } |
| 97 | + |
| 98 | + /** |
| 99 | + * Destructor. |
| 100 | + * |
| 101 | + * @since 0.4 |
| 102 | + */ |
| 103 | + public function __destruct() { |
| 104 | + xml_parser_free( $this->parser ); |
| 105 | + } |
| 106 | + |
| 107 | + /** |
| 108 | + * (non-PHPdoc) |
| 109 | + * @see LTTMParser::parse() |
| 110 | + */ |
| 111 | + public function parse( $text ) { |
| 112 | + $this->tm = new LTTranslationMemory(); |
| 113 | + |
| 114 | + // Attempt to parse the TMX. |
| 115 | + if( !xml_parse( $this->parser, $text ) ) { |
| 116 | + // xml_error_string(xml_get_error_code($this->parser)) |
| 117 | + // xml_get_current_line_number($this->parser)) |
| 118 | + } |
| 119 | + |
| 120 | + return $this->tm; |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * Sets the start element handler function for the XML parser parser.start_element_handler. |
| 125 | + * |
| 126 | + * @param resource $parser The first parameter, parser, is a reference to the XML parser calling the handler. |
| 127 | + * @param string $name The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters. |
| 128 | + * @param array $attribs The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on. |
| 129 | + */ |
| 130 | + protected function startElementHandler( $parser, $name, $attribs ) { |
| 131 | + switch( strtolower( $name ) ) { |
| 132 | + case 'tu': |
| 133 | + // A new translation unit node has been entered, so create a new translation unit object. |
| 134 | + $this->tu = new LTTMUnit(); |
| 135 | + break; |
| 136 | + case 'tuv': |
| 137 | + if ( array_key_exists( 'xml:lang', $attribs ) ) { |
| 138 | + $this->currentLanguage = $attribs['xml:lang']; |
| 139 | + } |
| 140 | + else { |
| 141 | + // TODO: ignore node or give warning |
| 142 | + } |
| 143 | + break; |
| 144 | + case 'seg': |
| 145 | + $this->currentTranslation = ''; |
| 146 | + $this->insideSegment = true; |
| 147 | + break; |
| 148 | + case 'ut' : |
| 149 | + $this->insideIgnoreNode = true; |
| 150 | + break; |
| 151 | + } |
| 152 | + } |
| 153 | + |
| 154 | + /** |
| 155 | + * Sets the end element handler function for the XML parser parser.end_element_handler. |
| 156 | + * |
| 157 | + * @since 0.4 |
| 158 | + * |
| 159 | + * @param resource $parser The first parameter, parser, is a reference to the XML parser calling the handler. |
| 160 | + * @param string $name The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters. |
| 161 | + */ |
| 162 | + protected function endElementHandler($parser, $name) { |
| 163 | + switch( strtolower( $name ) ) { |
| 164 | + case 'tu': |
| 165 | + // We are leaving the translation unit node, so add the translation unit to the translation memory. |
| 166 | + if ( $this->tu->hasVariants() ) { |
| 167 | + $this->tm->addTranslationUnit( $this->tu ); |
| 168 | + } |
| 169 | + break; |
| 170 | + case 'tuv': |
| 171 | + $this->tu->addVariant( $this->currentLanguage, $this->currentTranslation ); |
| 172 | + break; |
| 173 | + case 'seg': |
| 174 | + $this->insideSegment = false; |
| 175 | + break; |
| 176 | + case 'ut' : |
| 177 | + $this->insideIgnoreNode = false; |
| 178 | + break; |
| 179 | + } |
| 180 | + } |
| 181 | + |
| 182 | + /** |
| 183 | + * Sets the character data handler function for the XML parser parser.handler. |
| 184 | + * |
| 185 | + * @since 0.4 |
| 186 | + * |
| 187 | + * @param resource $parser The first parameter, parser, is a reference to the XML parser calling the handler. |
| 188 | + * @param string $data The second parameter, data, contains the character data as a string. |
| 189 | + */ |
| 190 | + protected function segmentContentHandler( $parser, $data ) { |
| 191 | + if ( $this->insideSegment && !$this->insideIgnoreNode ) { |
| 192 | + $this->currentTranslation .= $data; |
| 193 | + } |
| 194 | + } |
| 195 | + |
| 196 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_TMXParser.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 197 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/LiveTranslate_Functions.php |
— | — | @@ -0,0 +1,440 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Static 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 | + $wgOut->addScript( |
| 26 | + Html::inlineScript( |
| 27 | + 'var ltDebugMessages = ' . FormatJson::encode( $GLOBALS['egLiveTranslateDebugJS'] ) . ';' |
| 28 | + ) |
| 29 | + ); |
| 30 | + |
| 31 | + // For backward compatibility with MW < 1.17. |
| 32 | + if ( is_callable( array( $wgOut, 'addModules' ) ) ) { |
| 33 | + $modules = array( 'ext.livetranslate' ); |
| 34 | + |
| 35 | + switch( $GLOBALS['egLiveTranslateService'] ) { |
| 36 | + case LTS_GOOGLE: |
| 37 | + $modules[] = 'ext.lt.google'; |
| 38 | + $wgOut->addHeadItem( |
| 39 | + 'ext.lt.google.jsapi', |
| 40 | + Html::linkedScript( 'https://www.google.com/jsapi?key=' . htmlspecialchars( $GLOBALS['egGoogleApiKey'] ) ) |
| 41 | + ); |
| 42 | + break; |
| 43 | + case LTS_MS: |
| 44 | + $modules[] = 'ext.lt.ms'; |
| 45 | + $wgOut->addScript( |
| 46 | + Html::inlineScript( |
| 47 | + 'var ltMsAppId = ' . FormatJson::encode( $GLOBALS['egLiveTranslateMSAppId'] ) . ';' |
| 48 | + ) |
| 49 | + ); |
| 50 | + break; |
| 51 | + } |
| 52 | + |
| 53 | + $wgOut->addModules( $modules ); |
| 54 | + } |
| 55 | + else { |
| 56 | + global $egLiveTranslateScriptPath; |
| 57 | + |
| 58 | + self::addJSLocalisation(); |
| 59 | + |
| 60 | + $wgOut->includeJQuery(); |
| 61 | + |
| 62 | + $wgOut->addHeadItem( |
| 63 | + 'ext.livetranslate', |
| 64 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.livetranslate.js' ) |
| 65 | + ); |
| 66 | + |
| 67 | + switch( $GLOBALS['egLiveTranslateService'] ) { |
| 68 | + case LTS_GOOGLE: |
| 69 | + $wgOut->addHeadItem( |
| 70 | + 'ext.lt.google.jsapi', |
| 71 | + Html::linkedScript( 'https://www.google.com/jsapi?key=' . htmlspecialchars( $GLOBALS['egGoogleApiKey'] ) ) |
| 72 | + ); |
| 73 | + |
| 74 | + $wgOut->addHeadItem( |
| 75 | + 'ext.lt.google', |
| 76 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.lt.google.js' ) |
| 77 | + ); |
| 78 | + break; |
| 79 | + case LTS_MS: |
| 80 | + $wgOut->addScript( |
| 81 | + Html::inlineScript( |
| 82 | + 'var ltMsAppId = ' . FormatJson::encode( $GLOBALS['egLiveTranslateMSAppId'] ) . ';' |
| 83 | + ) |
| 84 | + ); |
| 85 | + $wgOut->addHeadItem( |
| 86 | + 'ext.lt.ms', |
| 87 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.lt.ms.js' ) |
| 88 | + ); |
| 89 | + break; |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + /** |
| 95 | + * Adds the needed JS messages to the page output. |
| 96 | + * This is for backward compatibility with pre-RL MediaWiki. |
| 97 | + * |
| 98 | + * @since 0.1 |
| 99 | + */ |
| 100 | + protected static function addJSLocalisation() { |
| 101 | + global $egLTJSMessages, $wgOut; |
| 102 | + |
| 103 | + $data = array(); |
| 104 | + |
| 105 | + foreach ( $egLTJSMessages as $msg ) { |
| 106 | + $data[$msg] = wfMsgNoTrans( $msg ); |
| 107 | + } |
| 108 | + |
| 109 | + $wgOut->addInlineScript( 'var wgLTEMessages = ' . FormatJson::encode( $data ) . ';' ); |
| 110 | + } |
| 111 | + |
| 112 | + /** |
| 113 | + * Returns the language code for a title. |
| 114 | + * |
| 115 | + * @param Title $title |
| 116 | + * |
| 117 | + * @return string |
| 118 | + */ |
| 119 | + public static function getCurrentLang( Title $title ) { |
| 120 | + $subPage = explode( '/', $title->getSubpageText() ); |
| 121 | + $subPage = array_pop( $subPage ); |
| 122 | + |
| 123 | + if ( $subPage != '' && array_key_exists( $subPage, Language::getLanguageNames( false ) ) ) { |
| 124 | + return $subPage; |
| 125 | + } |
| 126 | + |
| 127 | + global $wgLanguageCode; |
| 128 | + return $wgLanguageCode; |
| 129 | + } |
| 130 | + |
| 131 | + /** |
| 132 | + * Returns the HTML for a language selector. |
| 133 | + * |
| 134 | + * @since 0.1 |
| 135 | + * |
| 136 | + * @param string $currentLang |
| 137 | + * |
| 138 | + * @return string |
| 139 | + */ |
| 140 | + public static function getLanguageSelector( $currentLang ) { |
| 141 | + global $wgUser, $wgLanguageCode, $egLiveTranslateLanguages; |
| 142 | + |
| 143 | + $allowedLanguages = array_merge( $egLiveTranslateLanguages, array( $currentLang ) ); |
| 144 | + |
| 145 | + $targetLang = $wgLanguageCode; |
| 146 | + |
| 147 | + $languages = Language::getLanguageNames( false ); |
| 148 | + |
| 149 | + if ( $wgUser->isLoggedIn() ) { |
| 150 | + $userLang = $wgUser->getOption( 'language' ); |
| 151 | + |
| 152 | + if ( array_key_exists( $userLang, $languages ) && in_array( $userLang, $allowedLanguages ) ) { |
| 153 | + $targetLang = $userLang; |
| 154 | + } |
| 155 | + } |
| 156 | + |
| 157 | + $options = array(); |
| 158 | + ksort( $languages ); |
| 159 | + |
| 160 | + foreach ( $languages as $code => $name ) { |
| 161 | + if ( in_array( $code, $allowedLanguages ) && $code != $currentLang ) { |
| 162 | + $display = wfBCP47( $code ) . ' - ' . $name; |
| 163 | + $options[$display] = $code; |
| 164 | + } |
| 165 | + } |
| 166 | + |
| 167 | + $languageSelector = new HTMLSelectField( array( |
| 168 | + 'id' => 'livetranslatelang', |
| 169 | + 'fieldname' => 'language', |
| 170 | + 'options' => $options |
| 171 | + ) ); |
| 172 | + |
| 173 | + return $languageSelector->getInputHTML( $targetLang ); |
| 174 | + } |
| 175 | + |
| 176 | + /** |
| 177 | + * Gets a list of all available languages. |
| 178 | + * |
| 179 | + * @since 0.1 |
| 180 | + * |
| 181 | + * @return array |
| 182 | + */ |
| 183 | + public static function getAvailableLanguages() { |
| 184 | + $dbr = wfGetDB( DB_SLAVE ); |
| 185 | + |
| 186 | + $destinationLangs = array(); |
| 187 | + |
| 188 | + // TODO: fix index |
| 189 | + $res = $dbr->query( 'SELECT DISTINCT word_language FROM ' . $dbr->tableName( 'live_translate' ) ); |
| 190 | + |
| 191 | + while ( $lang = $dbr->fetchObject( $res ) ) { |
| 192 | + $destinationLangs[] = $lang->word_language; |
| 193 | + } |
| 194 | + |
| 195 | + return $destinationLangs; |
| 196 | + } |
| 197 | + |
| 198 | + /** |
| 199 | + * Returns a PHP version of the JavaScript google.language.Languages enum of the Google Translate v1 API. |
| 200 | + * @see https://code.google.com/apis/language/translate/v1/getting_started.html#LangNameArray |
| 201 | + * |
| 202 | + * @since 0.1 |
| 203 | + * |
| 204 | + * @return array LANGUAGE_NAME => 'code' |
| 205 | + */ |
| 206 | + public static function getGTSupportedLanguages() { //Language::getLanguageNames( false ); |
| 207 | + return array( |
| 208 | + 'AFRIKAANS' => 'af', |
| 209 | + 'ALBANIAN' => 'sq', |
| 210 | + 'AMHARIC' => 'am', |
| 211 | + 'ARABIC' => 'ar', |
| 212 | + 'ARMENIAN' => 'hy', |
| 213 | + 'AZERBAIJANI' => 'az', |
| 214 | + 'BASQUE' => 'eu', |
| 215 | + 'BELARUSIAN' => 'be', |
| 216 | + 'BENGALI' => 'bn', |
| 217 | + 'BIHARI' => 'bh', |
| 218 | + 'BRETON' => 'br', |
| 219 | + 'BULGARIAN' => 'bg', |
| 220 | + 'BURMESE' => 'my', |
| 221 | + 'CATALAN' => 'ca', |
| 222 | + 'CHEROKEE' => 'chr', |
| 223 | + 'CHINESE' => 'zh', |
| 224 | + 'CHINESE_SIMPLIFIED' => 'zh-CN', |
| 225 | + 'CHINESE_TRADITIONAL' => 'zh-TW', |
| 226 | + 'CORSICAN' => 'co', |
| 227 | + 'CROATIAN' => 'hr', |
| 228 | + 'CZECH' => 'cs', |
| 229 | + 'DANISH' => 'da', |
| 230 | + 'DHIVEHI' => 'dv', |
| 231 | + 'DUTCH'=> 'nl', |
| 232 | + 'ENGLISH' => 'en', |
| 233 | + 'ESPERANTO' => 'eo', |
| 234 | + 'ESTONIAN' => 'et', |
| 235 | + 'FAROESE' => 'fo', |
| 236 | + 'FILIPINO' => 'tl', |
| 237 | + 'FINNISH' => 'fi', |
| 238 | + 'FRENCH' => 'fr', |
| 239 | + 'FRISIAN' => 'fy', |
| 240 | + 'GALICIAN' => 'gl', |
| 241 | + 'GEORGIAN' => 'ka', |
| 242 | + 'GERMAN' => 'de', |
| 243 | + 'GREEK' => 'el', |
| 244 | + 'GUJARATI' => 'gu', |
| 245 | + 'HAITIAN_CREOLE' => 'ht', |
| 246 | + 'HEBREW' => 'iw', |
| 247 | + 'HINDI' => 'hi', |
| 248 | + 'HUNGARIAN' => 'hu', |
| 249 | + 'ICELANDIC' => 'is', |
| 250 | + 'INDONESIAN' => 'id', |
| 251 | + 'INUKTITUT' => 'iu', |
| 252 | + 'IRISH' => 'ga', |
| 253 | + 'ITALIAN' => 'it', |
| 254 | + 'JAPANESE' => 'ja', |
| 255 | + 'JAVANESE' => 'jw', |
| 256 | + 'KANNADA' => 'kn', |
| 257 | + 'KAZAKH' => 'kk', |
| 258 | + 'KHMER' => 'km', |
| 259 | + 'KOREAN' => 'ko', |
| 260 | + 'KURDISH'=> 'ku', |
| 261 | + 'KYRGYZ'=> 'ky', |
| 262 | + 'LAO' => 'lo', |
| 263 | + 'LATIN' => 'la', |
| 264 | + 'LATVIAN' => 'lv', |
| 265 | + 'LITHUANIAN' => 'lt', |
| 266 | + 'LUXEMBOURGISH' => 'lb', |
| 267 | + 'MACEDONIAN' => 'mk', |
| 268 | + 'MALAY' => 'ms', |
| 269 | + 'MALAYALAM' => 'ml', |
| 270 | + 'MALTESE' => 'mt', |
| 271 | + 'MAORI' => 'mi', |
| 272 | + 'MARATHI' => 'mr', |
| 273 | + 'MONGOLIAN' => 'mn', |
| 274 | + 'NEPALI' => 'ne', |
| 275 | + 'NORWEGIAN' => 'no', |
| 276 | + 'OCCITAN' => 'oc', |
| 277 | + 'ORIYA' => 'or', |
| 278 | + 'PASHTO' => 'ps', |
| 279 | + 'PERSIAN' => 'fa', |
| 280 | + 'POLISH' => 'pl', |
| 281 | + 'PORTUGUESE' => 'pt', |
| 282 | + 'PORTUGUESE_PORTUGAL' => 'pt-PT', |
| 283 | + 'PUNJABI' => 'pa', |
| 284 | + 'QUECHUA' => 'qu', |
| 285 | + 'ROMANIAN' => 'ro', |
| 286 | + 'RUSSIAN' => 'ru', |
| 287 | + 'SANSKRIT' => 'sa', |
| 288 | + 'SCOTS_GAELIC' => 'gd', |
| 289 | + 'SERBIAN' => 'sr', |
| 290 | + 'SINDHI' => 'sd', |
| 291 | + 'SINHALESE' => 'si', |
| 292 | + 'SLOVAK' => 'sk', |
| 293 | + 'SLOVENIAN' => 'sl', |
| 294 | + 'SPANISH' => 'es', |
| 295 | + 'SUNDANESE' => 'su', |
| 296 | + 'SWAHILI' => 'sw', |
| 297 | + 'SWEDISH' => 'sv', |
| 298 | + 'SYRIAC' => 'syr', |
| 299 | + 'TAJIK' => 'tg', |
| 300 | + 'TAMIL' => 'ta', |
| 301 | + 'TATAR' => 'tt', |
| 302 | + 'TELUGU' => 'te', |
| 303 | + 'THAI' => 'th', |
| 304 | + 'TIBETAN' => 'bo', |
| 305 | + 'TONGA' => 'to', |
| 306 | + 'TURKISH' => 'tr', |
| 307 | + 'UKRAINIAN' => 'uk', |
| 308 | + 'URDU' => 'ur', |
| 309 | + 'UZBEK' => 'uz', |
| 310 | + 'UIGHUR' => 'ug', |
| 311 | + 'VIETNAMESE' => 'vi', |
| 312 | + 'WELSH' => 'cy', |
| 313 | + 'YIDDISH' => 'yi', |
| 314 | + 'YORUBA' => 'yo', |
| 315 | + ); |
| 316 | + } |
| 317 | + |
| 318 | + /** |
| 319 | + * Returns an array with mapping from input language codes to MediaWiki language codes. |
| 320 | + * |
| 321 | + * @since 0.4 |
| 322 | + * |
| 323 | + * @return array |
| 324 | + */ |
| 325 | + public static function getInputLangMapping() { |
| 326 | + return array( |
| 327 | + 'en-us' => 'en', |
| 328 | + ); |
| 329 | + } |
| 330 | + |
| 331 | + /** |
| 332 | + * Returns an array with mapping from MediaWiki language codes to Google Translate language codes. |
| 333 | + * |
| 334 | + * @since 0.4 |
| 335 | + * |
| 336 | + * @return array |
| 337 | + */ |
| 338 | + public static function getOuputLangMapping() { |
| 339 | + return array( |
| 340 | + 'en-us' => 'en', |
| 341 | + 'en-gb' => 'en', |
| 342 | + ); |
| 343 | + } |
| 344 | + |
| 345 | + /** |
| 346 | + * Returns the provided text starting with a letter in toggled case. |
| 347 | + * If there is no difference between lowercase and upercase for the first |
| 348 | + * character, false is returned. |
| 349 | + * |
| 350 | + * @since 0.1 |
| 351 | + * |
| 352 | + * @param string $text |
| 353 | + * |
| 354 | + * @return mixed |
| 355 | + */ |
| 356 | + public static function getToggledCase( $text ) { |
| 357 | + $isUpper = Language::firstChar( $text) == strtoupper( Language::firstChar( $text) ); |
| 358 | + $isLower = Language::firstChar( $text) == strtolower( Language::firstChar( $text) ); |
| 359 | + |
| 360 | + if ( $isUpper XOR $isLower ) { |
| 361 | + $text = $isUpper ? Language::lcfirst( $text ) : Language::ucfirst( $text ); |
| 362 | + return $text; |
| 363 | + } |
| 364 | + else { |
| 365 | + return false; |
| 366 | + } |
| 367 | + } |
| 368 | + |
| 369 | + /** |
| 370 | + * Returns the names of the pages containing a translation memory. |
| 371 | + * |
| 372 | + * @since 0.4 |
| 373 | + * |
| 374 | + * @return array |
| 375 | + */ |
| 376 | + public static function getLocalMemoryNames() { |
| 377 | + $dbr = wfGetDb( DB_MASTER ); |
| 378 | + |
| 379 | + $res = $dbr->select( |
| 380 | + 'live_translate_memories', |
| 381 | + array( 'memory_location' ), |
| 382 | + array( 'memory_local' => 1 ), |
| 383 | + __METHOD__, |
| 384 | + array( 'LIMIT' => '5000' ) |
| 385 | + ); |
| 386 | + |
| 387 | + $names = array(); |
| 388 | + |
| 389 | + foreach ( $res as $tm ) { |
| 390 | + $names[] = $tm->memory_location; |
| 391 | + } |
| 392 | + |
| 393 | + return $names; |
| 394 | + } |
| 395 | + |
| 396 | + /** |
| 397 | + * Returns the type of a translation memory when given it's location. |
| 398 | + * If the memory is not found, -1 is returned. |
| 399 | + * |
| 400 | + * @since 0.4 |
| 401 | + * |
| 402 | + * @param string $location |
| 403 | + * |
| 404 | + * @return integer |
| 405 | + */ |
| 406 | + public static function getMemoryType( $location ) { |
| 407 | + $dbr = wfGetDb( DB_MASTER ); |
| 408 | + |
| 409 | + $res = $dbr->select( |
| 410 | + 'live_translate_memories', |
| 411 | + array( 'memory_type' ), |
| 412 | + array( 'memory_location' => $location ), |
| 413 | + __METHOD__, |
| 414 | + array( 'LIMIT' => '5000' ) |
| 415 | + ); |
| 416 | + |
| 417 | + $type = -1; |
| 418 | + |
| 419 | + foreach ( $res as $row ) { |
| 420 | + $type = $row->memory_type; |
| 421 | + break; |
| 422 | + } |
| 423 | + |
| 424 | + return $type; |
| 425 | + } |
| 426 | + |
| 427 | + /** |
| 428 | + * Returns if there is a translation service that can be used or not. |
| 429 | + * |
| 430 | + * @since 1.1.1 |
| 431 | + * |
| 432 | + * @return boolean |
| 433 | + */ |
| 434 | + public static function hasTranslationService() { |
| 435 | + global $egLiveTranslateService, $egGoogleApiKey, $egLiveTranslateMSAppId; |
| 436 | + |
| 437 | + return ( $egLiveTranslateService == LTS_GOOGLE && $egGoogleApiKey != '' ) |
| 438 | + || ( $egLiveTranslateService == LTS_MS && $egLiveTranslateMSAppId != '' ); |
| 439 | + } |
| 440 | + |
| 441 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/LiveTranslate_Functions.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 442 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_TranslationMemory.php |
— | — | @@ -0,0 +1,76 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class describing a translation memory. |
| 6 | + * |
| 7 | + * @since 0.4 |
| 8 | + * |
| 9 | + * @file LT_TranslationMemory.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class LTTranslationMemory { |
| 16 | + |
| 17 | + /** |
| 18 | + * List of translation units in the translation memory. |
| 19 | + * |
| 20 | + * @since 0.4 |
| 21 | + * |
| 22 | + * @var array of LTTMUnit |
| 23 | + */ |
| 24 | + protected $translationUnits = array(); |
| 25 | + |
| 26 | + /** |
| 27 | + * Constructor for a new translation memory object. |
| 28 | + * |
| 29 | + * @since 0.4 |
| 30 | + */ |
| 31 | + public function __construct() { |
| 32 | + |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Adds a single LTTMUnit to the translation memory. |
| 37 | + * |
| 38 | + * @since 0.4 |
| 39 | + * |
| 40 | + * @param LTTMUnit $tu |
| 41 | + */ |
| 42 | + public function addTranslationUnit( LTTMUnit $tu ) { |
| 43 | + $this->translationUnits[] = $tu; |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Constructor for a new translation memory object. |
| 48 | + * |
| 49 | + * @since 0.4 |
| 50 | + */ |
| 51 | + public function getTranslationUnits() { |
| 52 | + return $this->translationUnits; |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * Returns the max amount of languages (variants) in a single translation unit. |
| 57 | + * Note: this might not be the total amount of unique languages! |
| 58 | + * |
| 59 | + * @since 0.4 |
| 60 | + * |
| 61 | + * @return integer |
| 62 | + */ |
| 63 | + public function getLanguageAmount() { |
| 64 | + $maxAmount = 0; |
| 65 | + |
| 66 | + foreach ( $this->translationUnits as $tu ) { |
| 67 | + $amount = $tu->getLanguageAmount(); |
| 68 | + |
| 69 | + if ( $amount > $maxAmount ) { |
| 70 | + $maxAmount = $amount; |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + return $maxAmount; |
| 75 | + } |
| 76 | + |
| 77 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/includes/LT_TranslationMemory.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 78 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/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 |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/COPYING |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 684 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/api/ApiQueryLiveTranslate.php |
— | — | @@ -0,0 +1,147 @@ |
| 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 | + $this->addTables( 'live_translate' ); |
| 31 | + |
| 32 | + $this->addFields( array( |
| 33 | + 'word_id', |
| 34 | + 'word_translation' |
| 35 | + ) ); |
| 36 | + |
| 37 | + $this->addWhere( array( |
| 38 | + 'word_language' => $params['language'] |
| 39 | + ) ); |
| 40 | + |
| 41 | + if ( !is_null( $params['continue'] ) ) { |
| 42 | + $dbr = wfGetDB( DB_SLAVE ); |
| 43 | + $this->addWhere( 'word_id >= ' . $dbr->addQuotes( $params['continue'] ) ); |
| 44 | + } |
| 45 | + |
| 46 | + $this->addOption( 'LIMIT', $params['limit'] + 1 ); |
| 47 | + $this->addOption( 'ORDER BY', 'word_id ASC' ); |
| 48 | + |
| 49 | + $words = $this->select( __METHOD__ ); |
| 50 | + $specialWords = array(); |
| 51 | + $count = 0; |
| 52 | + |
| 53 | + while ( $word = $words->fetchObject() ) { |
| 54 | + if ( ++$count > $params['limit'] ) { |
| 55 | + // We've reached the one extra which shows that |
| 56 | + // there are additional pages to be had. Stop here... |
| 57 | + $this->setContinueEnumParameter( 'continue', $word->word_id ); |
| 58 | + break; |
| 59 | + } |
| 60 | + |
| 61 | + $specialWords[] = $word->word_translation; |
| 62 | + } |
| 63 | + |
| 64 | + $toggeledSpecials = array(); |
| 65 | + |
| 66 | + foreach ( $specialWords as $word ) { |
| 67 | + $toggledWord = LiveTranslateFunctions::getToggledCase( $word ); |
| 68 | + |
| 69 | + if ( $toggledWord ) { |
| 70 | + $toggeledSpecials[] = $toggledWord; |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + foreach ( array_unique( array_merge( $specialWords, $toggeledSpecials ) ) as $word ) { |
| 75 | + $this->getResult()->addValue( |
| 76 | + 'words', |
| 77 | + null, |
| 78 | + $word |
| 79 | + ); |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * (non-PHPdoc) |
| 85 | + * @see includes/api/ApiBase#getAllowedParams() |
| 86 | + */ |
| 87 | + public function getAllowedParams() { |
| 88 | + return array ( |
| 89 | + 'language' => array( |
| 90 | + ApiBase::PARAM_TYPE => 'string', |
| 91 | + //ApiBase::PARAM_REQUIRED => true, |
| 92 | + ), |
| 93 | + 'limit' => array( |
| 94 | + ApiBase :: PARAM_DFLT => 500, |
| 95 | + ApiBase :: PARAM_TYPE => 'limit', |
| 96 | + ApiBase :: PARAM_MIN => 1, |
| 97 | + ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1, |
| 98 | + ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2 |
| 99 | + ), |
| 100 | + 'continue' => null, |
| 101 | + ); |
| 102 | + } |
| 103 | + |
| 104 | + /** |
| 105 | + * (non-PHPdoc) |
| 106 | + * @see includes/api/ApiBase#getParamDescription() |
| 107 | + */ |
| 108 | + public function getParamDescription() { |
| 109 | + return array ( |
| 110 | + 'language' => 'The language for which to return special words', |
| 111 | + 'continue' => 'Offset number from where to continue the query', |
| 112 | + 'limit' => 'Max amount of words to return', |
| 113 | + ); |
| 114 | + } |
| 115 | + |
| 116 | + /** |
| 117 | + * (non-PHPdoc) |
| 118 | + * @see includes/api/ApiBase#getDescription() |
| 119 | + */ |
| 120 | + public function getDescription() { |
| 121 | + return 'This module returns all special words defined in the wikis Live Translate Dictionary for a given language'; |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * (non-PHPdoc) |
| 126 | + * @see includes/api/ApiBase#getPossibleErrors() |
| 127 | + */ |
| 128 | + public function getPossibleErrors() { |
| 129 | + return array_merge( parent::getPossibleErrors(), array( |
| 130 | + array( 'missingparam', 'language' ), |
| 131 | + ) ); |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * (non-PHPdoc) |
| 136 | + * @see includes/api/ApiBase#getExamples() |
| 137 | + */ |
| 138 | + protected function getExamples() { |
| 139 | + return array ( |
| 140 | + 'api.php?action=query&list=livetranslate<language', |
| 141 | + ); |
| 142 | + } |
| 143 | + |
| 144 | + public function getVersion() { |
| 145 | + return __CLASS__ . ': $Id$'; |
| 146 | + } |
| 147 | + |
| 148 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/api/ApiQueryLiveTranslate.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 149 | + Id |
Added: svn:eol-style |
2 | 150 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/api/ApiImportTranslationMemories.php |
— | — | @@ -0,0 +1,201 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * API module to get special translations stored by the Live Translate extension. |
| 6 | + * |
| 7 | + * @since 0.4 |
| 8 | + * |
| 9 | + * @file ApiImportTranslationMemories.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class ApiImportTranslationMemories extends ApiBase { |
| 16 | + |
| 17 | + public function __construct( $main, $action ) { |
| 18 | + parent::__construct( $main, $action ); |
| 19 | + } |
| 20 | + |
| 21 | + public function execute() { |
| 22 | + global $wgUser; |
| 23 | + |
| 24 | + if ( !$wgUser->isAllowed( 'managetms' ) || $wgUser->isBlocked() ) { |
| 25 | + $this->dieUsageMsg( array( 'badaccess-groups' ) ); |
| 26 | + } |
| 27 | + |
| 28 | + $params = $this->extractRequestParams(); |
| 29 | + |
| 30 | + // In MW 1.17 and above ApiBase::PARAM_REQUIRED can be used, this is for b/c with 1.16. |
| 31 | + foreach ( array( 'source' ) as $requiredParam ) { |
| 32 | + if ( !isset( $params[$requiredParam] ) ) { |
| 33 | + $this->dieUsageMsg( array( 'missingparam', $requiredParam ) ); |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + foreach ( $params['source'] as $location ) { |
| 38 | + $text = false; |
| 39 | + |
| 40 | + $dbr = wfGetDB( DB_SLAVE ); |
| 41 | + |
| 42 | + $res = $dbr->select( |
| 43 | + 'live_translate_memories', |
| 44 | + array( 'memory_id', 'memory_local', 'memory_type' ), |
| 45 | + array( 'memory_location' => $location ), |
| 46 | + __METHOD__, |
| 47 | + array( 'LIMIT' => '1' ) |
| 48 | + ); |
| 49 | + |
| 50 | + foreach ( $res as $tm ) { |
| 51 | + if ( $tm->memory_local != '0' ) { |
| 52 | + // Obtain the contents of the article. |
| 53 | + $title = Title::newFromText( $location, NS_MAIN ); |
| 54 | + |
| 55 | + if ( is_object( $title ) && $title->exists() ) { |
| 56 | + $article = new Article( $title ); |
| 57 | + $text = $article->getContent(); |
| 58 | + } |
| 59 | + } |
| 60 | + else { |
| 61 | + // Make an HTTP request to get the file contents. False is returned on failiure. |
| 62 | + $text = Http::get( $location ); |
| 63 | + } |
| 64 | + |
| 65 | + if ( $text !== false ) { |
| 66 | + // If the text was obtained, parse it to a translation memory and import it into the db. |
| 67 | + $parser = LTTMParser::newFromType( $tm->memory_type ); |
| 68 | + $this->doTMImport( $parser->parse( $text ), $tm->memory_id ); |
| 69 | + } |
| 70 | + |
| 71 | + break; |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * Imports a translation memory into the database. |
| 78 | + * |
| 79 | + * @since 0.4 |
| 80 | + * |
| 81 | + * @param LTTranslationMemory $tm |
| 82 | + * @param integer $memoryId |
| 83 | + */ |
| 84 | + protected function doTMImport( LTTranslationMemory $tm, $memoryId ) { |
| 85 | + $dbw = wfGetDB( DB_MASTER ); |
| 86 | + |
| 87 | + // Delete the memory from the db if already there. |
| 88 | + $dbw->delete( |
| 89 | + 'live_translate', |
| 90 | + array( 'memory_id' => $memoryId ) |
| 91 | + ); |
| 92 | + |
| 93 | + $idOffset = ( $memoryId - 1 ) * 100000; |
| 94 | + $wordId = 0; |
| 95 | + |
| 96 | + $dbw->begin(); |
| 97 | + |
| 98 | + // Insert the memory in the db. |
| 99 | + foreach ( $tm->getTranslationUnits() as $tu ) { |
| 100 | + if ( $GLOBALS['egLTRequireSignificance'] && !$tu->isSignificant() ) { |
| 101 | + continue; |
| 102 | + } |
| 103 | + |
| 104 | + foreach ( $tu->getVariants() as $language => $translations ) { |
| 105 | + $primary = 1; |
| 106 | + |
| 107 | + foreach ( $translations as $translation ) { |
| 108 | + $dbw->insert( |
| 109 | + 'live_translate', |
| 110 | + array( |
| 111 | + 'word_id' => $idOffset + $wordId, |
| 112 | + 'word_language' => $this->cleanLanguage( $language ), |
| 113 | + 'word_translation' => $translation, |
| 114 | + 'word_primary' => $primary, |
| 115 | + 'memory_id' => $memoryId |
| 116 | + ) |
| 117 | + ); |
| 118 | + |
| 119 | + $primary = 0; |
| 120 | + } |
| 121 | + } |
| 122 | + |
| 123 | + $wordId++; |
| 124 | + |
| 125 | + if ( $wordId % 500 == 0 ) { |
| 126 | + $dbw->commit(); |
| 127 | + $dbw->begin(); |
| 128 | + } |
| 129 | + } |
| 130 | + |
| 131 | + $dbw->update( |
| 132 | + 'live_translate_memories', |
| 133 | + array( |
| 134 | + 'memory_lang_count' => $tm->getLanguageAmount(), |
| 135 | + 'memory_tu_count' => $wordId |
| 136 | + ), |
| 137 | + array( 'memory_id' => $memoryId ) |
| 138 | + ); |
| 139 | + |
| 140 | + $dbw->commit(); |
| 141 | + } |
| 142 | + |
| 143 | + /** |
| 144 | + * Cleans the language code. |
| 145 | + * |
| 146 | + * @since 0.4 |
| 147 | + * |
| 148 | + * @param string language |
| 149 | + * |
| 150 | + * @return string |
| 151 | + */ |
| 152 | + protected function cleanLanguage( $language ) { |
| 153 | + $language = strtolower( $language ); |
| 154 | + $mappings = LiveTranslateFunctions::getInputLangMapping(); |
| 155 | + |
| 156 | + if ( array_key_exists( $language, $mappings ) ) { |
| 157 | + $language = $mappings[$language]; |
| 158 | + } |
| 159 | + |
| 160 | + return $language; |
| 161 | + } |
| 162 | + |
| 163 | + public function getAllowedParams() { |
| 164 | + return array( |
| 165 | + 'source' => array( |
| 166 | + ApiBase::PARAM_TYPE => 'string', |
| 167 | + ApiBase::PARAM_ISMULTI => true, |
| 168 | + //ApiBase::PARAM_REQUIRED => true, |
| 169 | + ), |
| 170 | + ); |
| 171 | + } |
| 172 | + |
| 173 | + public function getParamDescription() { |
| 174 | + return array( |
| 175 | + 'source' => 'Location of the translation memory. Multiple sources can be provided using the | delimiter.', |
| 176 | + ); |
| 177 | + } |
| 178 | + |
| 179 | + public function getDescription() { |
| 180 | + return array( |
| 181 | + 'Imports one or more translation memories.' |
| 182 | + ); |
| 183 | + } |
| 184 | + |
| 185 | + public function getPossibleErrors() { |
| 186 | + return array_merge( parent::getPossibleErrors(), array( |
| 187 | + array( 'missingparam', 'source' ), |
| 188 | + ) ); |
| 189 | + } |
| 190 | + |
| 191 | + protected function getExamples() { |
| 192 | + return array( |
| 193 | + 'api.php?action=importtms&source=http://localhost/tmx.xml', |
| 194 | + 'api.php?action=importtms&source=http://localhost/tmx.xml|http://localhost/google.csv|Live Translate Dictionary', |
| 195 | + ); |
| 196 | + } |
| 197 | + |
| 198 | + public function getVersion() { |
| 199 | + return __CLASS__ . ': $Id$'; |
| 200 | + } |
| 201 | + |
| 202 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/api/ApiImportTranslationMemories.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 203 | + Id |
Added: svn:eol-style |
2 | 204 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/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$'; |
| 137 | + } |
| 138 | + |
| 139 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/api/ApiLiveTranslate.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 140 | + Id |
Added: svn:eol-style |
2 | 141 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.sql |
— | — | @@ -0,0 +1,22 @@ |
| 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 | + memory_id INT(4) unsigned NOT NULL |
| 11 | +) /*$wgDBTableOptions*/; |
| 12 | + |
| 13 | +-- Table to keep track of translation memories for the special words. |
| 14 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/live_translate_memories ( |
| 15 | + memory_id INT(4) unsigned NOT NULL auto_increment PRIMARY KEY, |
| 16 | + memory_type INT(2) unsigned NOT NULL, |
| 17 | + memory_location VARCHAR(255) NOT NULL, |
| 18 | + memory_local INT(1) unsigned NOT NULL, |
| 19 | + memory_lang_count INT(2) unsigned NOT NULL, |
| 20 | + memory_tu_count INT(8) unsigned NOT NULL |
| 21 | +) /*$wgDBTableOptions*/; |
| 22 | + |
| 23 | +INSERT INTO /*$wgDBprefix*/live_translate_memories VALUES (NULL, 0, "Live Translate Dictionary", 1, 0, 0); |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/LiveTranslate.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 24 | + native |
Index: tags/extensions/LiveTranslate/REL_1_1_1/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". |
Property changes on: tags/extensions/LiveTranslate/REL_1_1_1/README |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 49 | + native |