Index: tags/extensions/LiveTranslate/REL_1_2_1/sql/LT_IndexWordTranslation.sql |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +-- Adds word translation index on the live_translate table. |
| 3 | +-- Licence: GNU GPL v3+ |
| 4 | +-- Author: Jeroen De Dauw < jeroendedauw@gmail.com > |
| 5 | + |
| 6 | +CREATE INDEX word_translation ON /*$wgDBprefix*/live_translate (word_id, word_language); |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/sql/LT_IndexWordTranslation.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/sql/LT_addTMField.sql |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +-- Adds the memory_id field to the live_translate table, introduced in version 0.4. |
| 3 | +-- Licence: GNU GPL v3+ |
| 4 | +-- Author: Jeroen De Dauw < jeroendedauw@gmail.com > |
| 5 | + |
| 6 | +ALTER TABLE /*_*/live_translate ADD COLUMN memory_id INT(4) unsigned NOT NULL; |
| 7 | +UPDATE /*_*/live_translate SET memory_id = 1; |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/sql/LT_addTMField.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 8 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/sql/LT_addTMHashField.sql |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +-- Adds the memory_version_hash field to the live_translate_memories table. Change made in version 1.2. |
| 3 | +-- Licence: GNU GPL v3+ |
| 4 | +-- Author: Jeroen De Dauw < jeroendedauw@gmail.com > |
| 5 | + |
| 6 | +ALTER TABLE /*_*/live_translate_memories ADD COLUMN memory_version_hash VARCHAR(255) NOT NULL default '...'; |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/sql/LT_addTMHashField.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/LiveTranslate.i18n.magic.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 22 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate.i18n.php |
— | — | @@ -0,0 +1,1110 @@ |
| 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 | + 'group-tmxadmin' => 'TMX admins', |
| 23 | + 'group-tmxadmin-member' => 'TMX admin', |
| 24 | + 'grouppage-tmxadmin' => 'Project:TMX_admins', |
| 25 | + |
| 26 | + // Translation interface |
| 27 | + 'livetranslate-translate-to' => 'Translate this page to', |
| 28 | + 'livetranslate-button-translate' => 'Translate', |
| 29 | + 'livetranslate-button-translating' => 'Translating...', |
| 30 | + 'livetranslate-button-revert' => 'Show original', |
| 31 | + 'livetranslate-dictionary-error' => 'Could not obtain the live translate dictionary. No words will be treated as special during the translation process.', |
| 32 | + |
| 33 | + // Special words dictionary |
| 34 | + 'livetranslate-dictionary-empty' => 'There are no words in the dictionary yet. Click the "edit" tab to add some.', |
| 35 | + '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.', |
| 36 | + '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.', |
| 37 | + 'livetranslate-dictionary-goto-edit' => 'Modify the translation memories.', |
| 38 | + |
| 39 | + // Special:LiveTranslate |
| 40 | + 'special-livetranslate' => 'Live translate', |
| 41 | + 'livetranslate-tmtype-ltf' => 'Live Translate format', |
| 42 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 43 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 44 | + 'livetranslate-special-no-tms-yet' => 'There are no translation memories yet.', |
| 45 | + 'livetranslate-special-button' => 'Save and update', |
| 46 | + 'livetranslate-special-type' => 'Type', |
| 47 | + 'livetranslate-special-location' => 'Location', |
| 48 | + 'livetranslate-special-remove' => 'Remove', |
| 49 | + 'livetranslate-special-local' => 'Local', |
| 50 | + 'livetranslate-special-add-tm' => 'Add a new translation memory', |
| 51 | + 'livetranslate-special-current-tms' => 'Existing translation memories', |
| 52 | + 'livetranslate-special-tms-update' => 'Update translation memories', |
| 53 | + 'livetranslate-special-update' => 'Update translation memories', |
| 54 | + |
| 55 | + // API ImportTranslationMemories |
| 56 | + 'livetranslate-importtms-param-miscmatch' => 'Mismatch between amount of locations and types', |
| 57 | +); |
| 58 | + |
| 59 | +/** Message documentation (Message documentation) |
| 60 | + * @author EugeneZelenko |
| 61 | + * @author Jeroen De Dauw |
| 62 | + * @author Kghbln |
| 63 | + * @author Purodha |
| 64 | + * @author Raymond |
| 65 | + */ |
| 66 | +$messages['qqq'] = array( |
| 67 | + 'livetranslate-desc' => '{{desc}}', |
| 68 | + 'group-tmxadmin' => 'TMX = Translation Memory eXchange', |
| 69 | + 'group-tmxadmin-member' => 'TMX = Translation Memory eXchange', |
| 70 | + 'grouppage-tmxadmin' => 'TMX = Translation Memory eXchange', |
| 71 | + 'livetranslate-translate-to' => 'There is an [https://secure.wikimedia.org/wikipedia/mediawiki/wiki/File:Lte-article.png example screenshot of use]. |
| 72 | +Look at the right side in the line below the ruler under the "Main Page" header.', |
| 73 | + 'livetranslate-button-translate' => 'There is an [https://secure.wikimedia.org/wikipedia/mediawiki/wiki/File:Lte-article.png example screenshot of use]. |
| 74 | +Look at the right edge in the line below the ruler under the "Main Page" header.', |
| 75 | + 'livetranslate-special-type' => 'Table column header on Special:LiveTranslate |
| 76 | + |
| 77 | +{{Identical|Type}}', |
| 78 | + 'livetranslate-special-location' => '{{Identical|Location}} |
| 79 | + |
| 80 | +Table column header on Special:LiveTranslate', |
| 81 | + 'livetranslate-special-remove' => '{{Identical|Remove}}', |
| 82 | + 'livetranslate-special-local' => 'Table column header on Special:LiveTranslate', |
| 83 | + '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', |
| 84 | +); |
| 85 | + |
| 86 | +/** Afrikaans (Afrikaans) |
| 87 | + * @author Naudefj |
| 88 | + */ |
| 89 | +$messages['af'] = array( |
| 90 | + 'livetranslate-translate-to' => 'Vertaal die bladsy na', |
| 91 | + 'livetranslate-button-translate' => 'Vertaal', |
| 92 | + 'livetranslate-button-translating' => 'Besig met vertaling...', |
| 93 | + 'livetranslate-button-revert' => 'Wys oorspronklike', |
| 94 | + 'livetranslate-special-no-tms-yet' => 'Daar is nog geen vertaalgeheues nie.', |
| 95 | + 'livetranslate-special-button' => 'Stoor en opdateer', |
| 96 | + 'livetranslate-special-type' => 'Tipe', |
| 97 | + 'livetranslate-special-location' => 'Ligging', |
| 98 | + 'livetranslate-special-remove' => 'Verwyder', |
| 99 | + 'livetranslate-special-local' => 'Lokaal', |
| 100 | +); |
| 101 | + |
| 102 | +/** Azerbaijani (Azərbaycanca) |
| 103 | + * @author Cekli829 |
| 104 | + */ |
| 105 | +$messages['az'] = array( |
| 106 | + 'livetranslate-button-translate' => 'Tərcümə et', |
| 107 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 108 | + 'livetranslate-special-type' => 'Tipi', |
| 109 | + 'livetranslate-special-remove' => 'Çıxar', |
| 110 | + 'livetranslate-special-local' => 'Lokal', |
| 111 | +); |
| 112 | + |
| 113 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
| 114 | + * @author EugeneZelenko |
| 115 | + * @author Jim-by |
| 116 | + * @author Wizardist |
| 117 | + */ |
| 118 | +$messages['be-tarask'] = array( |
| 119 | + 'livetranslate-desc' => 'Дазваляе пераклады тэкстаў старонак на ляту ў Google Translate', |
| 120 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|зьмена]] сьпісу памяці перакладаў', |
| 121 | + 'group-tmxadmin' => 'Адміністратары TMX', |
| 122 | + 'group-tmxadmin-member' => 'Адміністратар TMX', |
| 123 | + 'grouppage-tmxadmin' => 'Project:Адміністратары TMX', |
| 124 | + 'livetranslate-translate-to' => 'Перакласьці гэту старонку на', |
| 125 | + 'livetranslate-button-translate' => 'Перакласьці', |
| 126 | + 'livetranslate-button-translating' => 'Ідзе пераклад…', |
| 127 | + 'livetranslate-button-revert' => 'Паказаць арыгінал', |
| 128 | + 'livetranslate-dictionary-error' => 'Немагчыма атрымаць слоўнік перакладу на ляту. Няма словаў, якая будуць разглядацца як спэцыяльныя, падчас працэсу перакладу.', |
| 129 | + 'livetranslate-dictionary-empty' => 'Пакуль што няма словаў у слоўніку. Націсьніце кнопку «рэдагаваць» каб дадаць.', |
| 130 | + 'livetranslate-dictionary-count' => 'Ёсьць $1 {{PLURAL:$1|слова|словы|словаў}} у $2 {{PLURAL:$2|мове|мовах|мовах}}. Націсьніце кнопку «рэдагаваць» каб дадаць болей.', |
| 131 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Гэтая мова не дазволеная|Гэтыя мовы не дазволеныя}} у цяперашні момант як мэтавыя для перакладу: $1. Зьмяніце дазволеныя мовы ў Вашых наладах {{GRAMMAR:родны|{{SITENAME}}}}, ці выдаліце са слоўніка.', |
| 132 | + 'livetranslate-dictionary-goto-edit' => 'Зьмяніць памяці перакладаў.', |
| 133 | + 'special-livetranslate' => 'Пераклад на ляту', |
| 134 | + 'livetranslate-tmtype-ltf' => 'Фармат перакладу на ляту', |
| 135 | + 'livetranslate-tmtype-tmx' => 'Абмен памяцьцю перакладаў', |
| 136 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 137 | + 'livetranslate-special-no-tms-yet' => 'Пакуль што няма памяці перакладаў.', |
| 138 | + 'livetranslate-special-button' => 'Захаваць і абнавіць', |
| 139 | + 'livetranslate-special-type' => 'Тып', |
| 140 | + 'livetranslate-special-location' => 'Месцазнаходжаньне', |
| 141 | + 'livetranslate-special-remove' => 'Выдаліць', |
| 142 | + 'livetranslate-special-local' => 'Лякальная', |
| 143 | + 'livetranslate-special-add-tm' => 'Дадаць новую памяць перакладаў', |
| 144 | + 'livetranslate-special-current-tms' => 'Існуючыя памяці перакладаў', |
| 145 | + 'livetranslate-special-tms-update' => 'Абнавіць памяці перакладаў', |
| 146 | + 'livetranslate-special-update' => 'Абнавіць памяці перакладаў', |
| 147 | + 'livetranslate-importtms-param-miscmatch' => 'Несупадзеньне паміж колькасьцю знаходжаньняў і тыпамі', |
| 148 | +); |
| 149 | + |
| 150 | +/** Bulgarian (Български) |
| 151 | + * @author DCLXVI |
| 152 | + */ |
| 153 | +$messages['bg'] = array( |
| 154 | + 'livetranslate-button-translate' => 'Превеждане', |
| 155 | + 'livetranslate-button-translating' => 'Превеждане...', |
| 156 | + 'livetranslate-special-remove' => 'Премахване', |
| 157 | +); |
| 158 | + |
| 159 | +/** Bengali (বাংলা) |
| 160 | + * @author Wikitanvir |
| 161 | + */ |
| 162 | +$messages['bn'] = array( |
| 163 | + 'livetranslate-button-translate' => 'অনুবাদ', |
| 164 | + 'livetranslate-button-translating' => 'অনুবাদ করা হচ্ছে...', |
| 165 | + 'livetranslate-button-revert' => 'মূলটি দেখাও', |
| 166 | + 'special-livetranslate' => 'সরাসরি অনুবাদ', |
| 167 | + 'livetranslate-tmtype-ltf' => 'সরাসরি অনুবাদের ফরম্যাট', |
| 168 | + 'livetranslate-tmtype-gcsv' => 'গুগল সিএসভি', |
| 169 | + 'livetranslate-special-no-tms-yet' => 'এখনও কোনো অনুবাদ মেমোরি নেই।', |
| 170 | + 'livetranslate-special-button' => 'সংরক্ষণ ও হালনাগাদ', |
| 171 | + 'livetranslate-special-type' => 'ধরন', |
| 172 | + 'livetranslate-special-location' => 'অবস্থান', |
| 173 | + 'livetranslate-special-remove' => 'অপসারণ', |
| 174 | + 'livetranslate-special-local' => 'স্থানীয়', |
| 175 | + 'livetranslate-special-add-tm' => 'নতুন অনুবাদ মেমোরি যোগ করো', |
| 176 | + 'livetranslate-special-current-tms' => 'ইতিমধ্যেই থাকা অনুবাদ মেমোরিসমূহ', |
| 177 | + 'livetranslate-special-tms-update' => 'অনুবাদ মেমোরিসমূহ হালনাগাদ করুন', |
| 178 | + 'livetranslate-special-update' => 'অনুবাদ মেমোরিসমূহ হালনাগাদ করুন', |
| 179 | +); |
| 180 | + |
| 181 | +/** Breton (Brezhoneg) |
| 182 | + * @author Fulup |
| 183 | + */ |
| 184 | +$messages['br'] = array( |
| 185 | + 'livetranslate-desc' => 'Aotren a ra treiñ danvez ur bajenn war-eeun en ur ober gant servij treiñ Google', |
| 186 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Kemmañ]] roll ar memorioù treiñ', |
| 187 | + 'livetranslate-translate-to' => 'Treiñ ar bajenn-mañ e', |
| 188 | + 'livetranslate-button-translate' => 'Treiñ', |
| 189 | + 'livetranslate-button-translating' => 'O treiñ...', |
| 190 | + 'livetranslate-button-revert' => 'Diskouez ar stumm orin', |
| 191 | + '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.', |
| 192 | + 'livetranslate-dictionary-empty' => 'Ger ebet er geriadur evit c\'hoazh. Klikit war an ivinell "kemmañ" evit ouzhpennañ unan.', |
| 193 | + '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.', |
| 194 | + '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.", |
| 195 | + 'livetranslate-dictionary-goto-edit' => 'Kemmañ ar memorioù treiñ.', |
| 196 | + 'special-livetranslate' => 'Live translate', |
| 197 | + 'livetranslate-tmtype-ltf' => 'Furmad Live Translate', |
| 198 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 199 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 200 | + 'livetranslate-special-no-tms-yet' => "N'eus tamm memor treiñ ebet evit c'hoazh", |
| 201 | + 'livetranslate-special-button' => 'Enrollañ hag hizivaat', |
| 202 | + 'livetranslate-special-type' => 'Seurt', |
| 203 | + 'livetranslate-special-location' => "Lec'hiadur", |
| 204 | + 'livetranslate-special-remove' => 'Dilemel', |
| 205 | + 'livetranslate-special-local' => "Lec'hel", |
| 206 | + 'livetranslate-special-add-tm' => 'Ouzhpennañ ur memor treiñ nevez', |
| 207 | + 'livetranslate-special-current-tms' => 'Memorioù treiñ hegerz', |
| 208 | + 'livetranslate-special-tms-update' => 'Hizivaat ar memorioù treiñ', |
| 209 | + 'livetranslate-special-update' => 'Hizivaat ar memorioù treiñ', |
| 210 | + 'livetranslate-importtms-param-miscmatch' => "Disklot etre ar c'hementad a lec'hiadurioù hag ar seurtoù", |
| 211 | +); |
| 212 | + |
| 213 | +/** Bosnian (Bosanski) |
| 214 | + * @author CERminator |
| 215 | + */ |
| 216 | +$messages['bs'] = array( |
| 217 | + 'livetranslate-desc' => 'Omogućuje prevođenje uživo sadržaja stranice koristeći uslugu Google Translate', |
| 218 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Mijenjanje]] spiska memorije za prevođenje', |
| 219 | + 'livetranslate-translate-to' => 'Prevedi ovu stranicu na', |
| 220 | + 'livetranslate-button-translate' => 'Prevedi', |
| 221 | + 'livetranslate-button-translating' => 'Prevodim...', |
| 222 | + 'livetranslate-button-revert' => 'Prikaži original', |
| 223 | + '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.', |
| 224 | + 'livetranslate-dictionary-empty' => "Još uvijek nema riječi u rječniku. Kliknite na jezičak ''uredi'' da ih dodate.", |
| 225 | + '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.', |
| 226 | + '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.', |
| 227 | + 'livetranslate-dictionary-goto-edit' => 'Izmijeni memorije prevoda.', |
| 228 | + 'special-livetranslate' => 'Prevođenje uživo', |
| 229 | + 'livetranslate-tmtype-ltf' => 'Format prevođenja uživo', |
| 230 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 231 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 232 | + 'livetranslate-special-no-tms-yet' => 'U memoriji još uvijek nema prevoda.', |
| 233 | + 'livetranslate-special-button' => 'Spremi i ažuriraj', |
| 234 | + 'livetranslate-special-type' => 'Vrsta', |
| 235 | + 'livetranslate-special-location' => 'Lokacija', |
| 236 | + 'livetranslate-special-remove' => 'Ukloni', |
| 237 | + 'livetranslate-special-local' => 'Lokalno', |
| 238 | + 'livetranslate-special-add-tm' => 'Dodaj novu memoriju prevoda', |
| 239 | + 'livetranslate-special-current-tms' => 'Postojeće memorije prevoda', |
| 240 | + 'livetranslate-special-tms-update' => 'Ažuriraj memorije prevoda', |
| 241 | + 'livetranslate-special-update' => 'Ažuriraj memorije prevoda', |
| 242 | + 'livetranslate-importtms-param-miscmatch' => 'Neslaganje između broja lokacija i vrsta', |
| 243 | +); |
| 244 | + |
| 245 | +/** German (Deutsch) |
| 246 | + * @author Kghbln |
| 247 | + * @author Purodha |
| 248 | + */ |
| 249 | +$messages['de'] = array( |
| 250 | + 'livetranslate-desc' => 'Ermöglicht die unmittelbare Übersetzung des Seiteninhalts mit „Google Übersetzer“', |
| 251 | + 'right-managetms' => 'Liste der Übersetzungsspeicher [[Special:SpecialLiveTranslate|anpassen]]', |
| 252 | + 'group-tmxadmin' => 'TMX-Administratoren', |
| 253 | + 'group-tmxadmin-member' => 'TMX-Administrator', |
| 254 | + 'grouppage-tmxadmin' => 'Project:TMX-Administratoren', |
| 255 | + 'livetranslate-translate-to' => 'Diese Seite in folgende Sprache übersetzen:', |
| 256 | + 'livetranslate-button-translate' => 'Übersetze', |
| 257 | + 'livetranslate-button-translating' => 'Übersetze …', |
| 258 | + 'livetranslate-button-revert' => 'Originalinhalt anzeigen', |
| 259 | + '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.', |
| 260 | + 'livetranslate-dictionary-empty' => 'Momentan befinden sich keine Vokabeln im Wörterbuch. Auf „Bearbeiten“ klicken, um welche hinzuzufügen.', |
| 261 | + '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.', |
| 262 | + '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.', |
| 263 | + 'livetranslate-dictionary-goto-edit' => 'Die Übersetzungsspeicher anpassen.', |
| 264 | + 'special-livetranslate' => 'Direktübersetzung', |
| 265 | + 'livetranslate-tmtype-ltf' => 'Live Translate format', |
| 266 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 267 | + 'livetranslate-tmtype-gcsv' => 'Google-CSV', |
| 268 | + 'livetranslate-special-no-tms-yet' => 'Momentan sind noch keine Übersetzungsspeicher vorhanden.', |
| 269 | + 'livetranslate-special-button' => 'Speichern und aktualisieren', |
| 270 | + 'livetranslate-special-type' => 'Art', |
| 271 | + 'livetranslate-special-location' => 'Ort', |
| 272 | + 'livetranslate-special-remove' => 'Entfernen', |
| 273 | + 'livetranslate-special-local' => 'Lokal', |
| 274 | + 'livetranslate-special-add-tm' => 'Einen neuen Übersetzungsspeicher anlegen', |
| 275 | + 'livetranslate-special-current-tms' => 'Vorhandene Übersetzungsspeicher', |
| 276 | + 'livetranslate-special-tms-update' => 'Übersetzungsspeicher aktualisieren', |
| 277 | + 'livetranslate-special-update' => 'Übersetzungsspeicher aktualisieren', |
| 278 | + 'livetranslate-importtms-param-miscmatch' => 'Missverhältnis zwischen Anzahl an Übersetzungsspeichern und Übersetzungsspeicherarten', |
| 279 | +); |
| 280 | + |
| 281 | +/** Lower Sorbian (Dolnoserbski) |
| 282 | + * @author Michawiki |
| 283 | + */ |
| 284 | +$messages['dsb'] = array( |
| 285 | + 'livetranslate-desc' => 'Zmóžnja direktne pśełožowanje wopśimjeśa boka z pomocu słužby "Google Translate"', |
| 286 | + 'livetranslate-translate-to' => 'Pśełož toś ten boko do', |
| 287 | + 'livetranslate-button-translate' => 'Pśełožyś', |
| 288 | + 'livetranslate-button-translating' => 'Pśełožujo se...', |
| 289 | + 'livetranslate-button-revert' => 'Original pokazaś', |
| 290 | + 'livetranslate-dictionary-error' => 'Słownik za Live Translate njedajo se zacytaś. Jogo słowa njezapśimuju se za pśełožowański proces.', |
| 291 | + 'livetranslate-dictionary-empty' => 'Hyšći njejsu žedne słowa w słowniku. Klikni na rejtark "wobźěłaś", aby někotare dodał.', |
| 292 | + '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ł.', |
| 293 | + '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.', |
| 294 | + 'livetranslate-dictionary-goto-edit' => 'Pśełožowańske składowaki změniś.', |
| 295 | + 'special-livetranslate' => 'Direktne přełožowanje', |
| 296 | + 'livetranslate-tmtype-ltf' => 'Live Translate format', |
| 297 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 298 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 299 | + 'livetranslate-special-no-tms-yet' => 'Pśełožowańske składowaki hyšći njejsu.', |
| 300 | + 'livetranslate-special-button' => 'Składowaś a aktualizěrowaś', |
| 301 | + 'livetranslate-special-type' => 'Typ', |
| 302 | + 'livetranslate-special-location' => 'Městno', |
| 303 | + 'livetranslate-special-remove' => 'Wótpóraś', |
| 304 | + 'livetranslate-special-local' => 'Lokalny', |
| 305 | + 'livetranslate-special-add-tm' => 'Nowy pśełožowański składowak pśidaś', |
| 306 | + 'livetranslate-special-current-tms' => 'Eksistěrujuce pśełožowańske składowaki', |
| 307 | + 'livetranslate-special-tms-update' => 'Pséłožowańske składowaki aktualizěrowaś', |
| 308 | + 'livetranslate-special-update' => 'Pséłožowańske składowaki aktualizěrowaś', |
| 309 | + 'livetranslate-importtms-param-miscmatch' => 'Njedobry poměr mjazy licbu městnow a typow', |
| 310 | +); |
| 311 | + |
| 312 | +/** Spanish (Español) |
| 313 | + * @author Fitoschido |
| 314 | + */ |
| 315 | +$messages['es'] = array( |
| 316 | + 'livetranslate-desc' => 'Permite la traducción instantánea de contenido utilizando el servicio de Google Translate', |
| 317 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modificar]] la lista de memorias de traducción', |
| 318 | + 'group-tmxadmin' => 'Administradores de TMX', |
| 319 | + 'group-tmxadmin-member' => 'Administrador de TMX', |
| 320 | + 'livetranslate-translate-to' => 'Traducir esta página a', |
| 321 | + 'livetranslate-button-translate' => 'Traducir', |
| 322 | + 'livetranslate-button-translating' => 'Traduciendo...', |
| 323 | + 'livetranslate-button-revert' => 'Mostrar original', |
| 324 | + 'livetranslate-dictionary-error' => 'No se pudo obtener el diccionario de traducción instantánea. Ninguna palabra será tratada especialmente durante el proceso de traducción.', |
| 325 | + 'livetranslate-dictionary-empty' => 'No hay palabras en el diccionario aún. Pulsa en la pestaña «editar» para añadir algunas.', |
| 326 | + 'livetranslate-dictionary-goto-edit' => 'Modificar las memorias de traducción.', |
| 327 | + 'special-livetranslate' => 'Traducción instantánea', |
| 328 | + 'livetranslate-tmtype-ltf' => 'Formato de traducción instantánea', |
| 329 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 330 | + 'livetranslate-tmtype-gcsv' => 'CSV de Google', |
| 331 | + 'livetranslate-special-no-tms-yet' => 'No hay memorias de traducción aún.', |
| 332 | + 'livetranslate-special-button' => 'Guardar y actualizar', |
| 333 | + 'livetranslate-special-type' => 'Tipo', |
| 334 | + 'livetranslate-special-location' => 'Ubicación', |
| 335 | + 'livetranslate-special-remove' => 'Quitar', |
| 336 | + 'livetranslate-special-local' => 'Local', |
| 337 | + 'livetranslate-special-add-tm' => 'Añadir una memoria de traducción nueva', |
| 338 | + 'livetranslate-special-current-tms' => 'Memorias de traducción existentes', |
| 339 | + 'livetranslate-special-tms-update' => 'Actualizar memorias de traducción', |
| 340 | + 'livetranslate-special-update' => 'Actualizar memorias de traducción', |
| 341 | +); |
| 342 | + |
| 343 | +/** Basque (Euskara) |
| 344 | + * @author An13sa |
| 345 | + */ |
| 346 | +$messages['eu'] = array( |
| 347 | + 'livetranslate-button-translate' => 'Itzuli', |
| 348 | + 'livetranslate-button-translating' => 'Itzultzen...', |
| 349 | + 'livetranslate-button-revert' => 'Jatorrizkoa erakutsi', |
| 350 | +); |
| 351 | + |
| 352 | +/** French (Français) |
| 353 | + * @author Crochet.david |
| 354 | + * @author Hashar |
| 355 | + * @author Sherbrooke |
| 356 | + */ |
| 357 | +$messages['fr'] = array( |
| 358 | + 'livetranslate-desc' => 'Permet la traduction immédiate du contenu de la page en utilisant le service de traduction de Google', |
| 359 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modifier]] la liste des mémoires de traduction', |
| 360 | + 'group-tmxadmin' => 'Admins TMX', |
| 361 | + 'group-tmxadmin-member' => 'Admin TMX', |
| 362 | + 'grouppage-tmxadmin' => 'Project:Admins_TMX', |
| 363 | + 'livetranslate-translate-to' => 'Traduire cette page en', |
| 364 | + 'livetranslate-button-translate' => 'Traduire', |
| 365 | + 'livetranslate-button-translating' => 'Traduction en cours...', |
| 366 | + 'livetranslate-button-revert' => 'Afficher l’original', |
| 367 | + '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.", |
| 368 | + 'livetranslate-dictionary-empty' => "Il n'y a aucun mot dans le dictionnaire encore. Cliquez sur l'onglet « Modifier » pour en ajouter.", |
| 369 | + '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.", |
| 370 | + '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.", |
| 371 | + 'livetranslate-dictionary-goto-edit' => 'Modifier les mémoires de traduction.', |
| 372 | + 'special-livetranslate' => 'Live translate', |
| 373 | + 'livetranslate-tmtype-ltf' => 'Format Live Translate', |
| 374 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 375 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 376 | + 'livetranslate-special-no-tms-yet' => "Il n'ya pas de mémoires de traduction pour le moment.", |
| 377 | + 'livetranslate-special-button' => 'Enregistrer et mettre à jour', |
| 378 | + 'livetranslate-special-type' => 'Type', |
| 379 | + 'livetranslate-special-location' => 'Localisation', |
| 380 | + 'livetranslate-special-remove' => 'Enlever', |
| 381 | + 'livetranslate-special-local' => 'Local', |
| 382 | + 'livetranslate-special-add-tm' => 'Ajouter une nouvelle mémoire de traduction', |
| 383 | + 'livetranslate-special-current-tms' => 'Mémoires de traduction existantes', |
| 384 | + 'livetranslate-special-tms-update' => 'Mise à jour de mémoires de traduction', |
| 385 | + 'livetranslate-special-update' => 'Mise à jour de mémoires de traduction', |
| 386 | + 'livetranslate-importtms-param-miscmatch' => "Incompatibilité entre la quantité d'emplacements et les types", |
| 387 | +); |
| 388 | + |
| 389 | +/** Franco-Provençal (Arpetan) |
| 390 | + * @author ChrisPtDe |
| 391 | + */ |
| 392 | +$messages['frp'] = array( |
| 393 | + 'group-tmxadmin' => 'Administrators TMX', |
| 394 | + 'group-tmxadmin-member' => 'Administrator TMX', |
| 395 | + 'grouppage-tmxadmin' => 'Project:Administrators_TMX', |
| 396 | + 'livetranslate-translate-to' => 'Traduire ceta pâge en', |
| 397 | + 'livetranslate-button-translate' => 'Traduire', |
| 398 | + 'livetranslate-button-translating' => 'Traduccion en cors...', |
| 399 | + 'livetranslate-button-revert' => 'Fâre vêre l’originâl', |
| 400 | + 'livetranslate-dictionary-goto-edit' => 'Changiér les mèmouères de traduccion.', |
| 401 | + 'special-livetranslate' => 'Traduccion en dirèct', |
| 402 | + 'livetranslate-tmtype-ltf' => 'Format de la traduccion en dirèct', |
| 403 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 404 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 405 | + 'livetranslate-special-no-tms-yet' => 'Y at gins de mèmouère de traduccion por lo moment.', |
| 406 | + 'livetranslate-special-button' => 'Encartar et betar a jorn', |
| 407 | + 'livetranslate-special-type' => 'Tipo', |
| 408 | + 'livetranslate-special-location' => 'Localisacion', |
| 409 | + 'livetranslate-special-remove' => 'Enlevar', |
| 410 | + 'livetranslate-special-local' => 'Local', |
| 411 | + 'livetranslate-special-add-tm' => 'Apondre una novèla mèmouère de traduccion', |
| 412 | + 'livetranslate-special-current-tms' => 'Mèmouères de traduccion ègzistentes', |
| 413 | + 'livetranslate-special-tms-update' => 'Betar a jorn des mèmouères de traduccion', |
| 414 | + 'livetranslate-special-update' => 'Betar a jorn des mèmouères de traduccion', |
| 415 | +); |
| 416 | + |
| 417 | +/** Galician (Galego) |
| 418 | + * @author Toliño |
| 419 | + */ |
| 420 | +$messages['gl'] = array( |
| 421 | + 'livetranslate-desc' => 'Activa a tradución en vivo do contido dunha páxina mediante o servizo de tradución do Google', |
| 422 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modificar]] a lista de memorias de tradución', |
| 423 | + 'group-tmxadmin' => 'Administradores TMX', |
| 424 | + 'group-tmxadmin-member' => 'Administrador TMX', |
| 425 | + 'grouppage-tmxadmin' => 'Project:Administradores TMX', |
| 426 | + 'livetranslate-translate-to' => 'Traducir esta páxina ao', |
| 427 | + 'livetranslate-button-translate' => 'Traducir', |
| 428 | + 'livetranslate-button-translating' => 'Traducindo...', |
| 429 | + 'livetranslate-button-revert' => 'Mostrar o orixinal', |
| 430 | + '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.', |
| 431 | + 'livetranslate-dictionary-empty' => 'Aínda non hai palabras no dicionario. Prema na lapela "Editar" para engadir algunha.', |
| 432 | + 'livetranslate-dictionary-count' => 'Hai $1 {{PLURAL:$1|palabra|palabras}} {{PLURAL:$2|nunha lingua|en $2 linguas}}. Prema na lapela "Editar" para engadir máis.', |
| 433 | + '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.', |
| 434 | + 'livetranslate-dictionary-goto-edit' => 'Modificar as memorias de tradución.', |
| 435 | + 'special-livetranslate' => 'Tradución en vivo', |
| 436 | + 'livetranslate-tmtype-ltf' => 'Formato da tradución en vivo', |
| 437 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 438 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 439 | + 'livetranslate-special-no-tms-yet' => 'Aínda non hai memorias de tradución.', |
| 440 | + 'livetranslate-special-button' => 'Gardar e actualizar', |
| 441 | + 'livetranslate-special-type' => 'Tipo', |
| 442 | + 'livetranslate-special-location' => 'Localización', |
| 443 | + 'livetranslate-special-remove' => 'Eliminar', |
| 444 | + 'livetranslate-special-local' => 'Local', |
| 445 | + 'livetranslate-special-add-tm' => 'Engadir unha nova memoria de tradución', |
| 446 | + 'livetranslate-special-current-tms' => 'Memorias de tradución existentes', |
| 447 | + 'livetranslate-special-tms-update' => 'Actualizar as memorias de tradución', |
| 448 | + 'livetranslate-special-update' => 'Actualizar as memorias de tradución', |
| 449 | + 'livetranslate-importtms-param-miscmatch' => 'Discordancia entre a cantidade de localizacións e os tipos', |
| 450 | +); |
| 451 | + |
| 452 | +/** Swiss German (Alemannisch) |
| 453 | + * @author Als-Holder |
| 454 | + */ |
| 455 | +$messages['gsw'] = array( |
| 456 | + 'livetranslate-desc' => 'Macht di diräkt Ibersetzig vum Syteninhalt megli mit „Google Ibersetzer“', |
| 457 | + 'livetranslate-translate-to' => 'Die Syte ibersetze in', |
| 458 | + 'livetranslate-button-translate' => 'Ibersetze', |
| 459 | + 'livetranslate-button-translating' => 'Am Ibersetze …', |
| 460 | + 'livetranslate-button-revert' => 'Originalinhalt aazeige', |
| 461 | + '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.', |
| 462 | + 'livetranslate-dictionary-empty' => 'Zurzyt het s kei Vokable im Werterbuech. Uf „Bearbeite“ klicke go ne baar yyfiege.', |
| 463 | + '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.', |
| 464 | + '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.', |
| 465 | + 'livetranslate-dictionary-goto-edit' => 'D Ibersetzigsspycher aapasse.', |
| 466 | + 'special-livetranslate' => 'Diräktibersetzig', |
| 467 | + 'livetranslate-tmtype-ltf' => 'Live Translate-Format', |
| 468 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 469 | + 'livetranslate-tmtype-gcsv' => 'Google-CSV', |
| 470 | + 'livetranslate-special-no-tms-yet' => 'S git no kei Ibersetzigsspycher.', |
| 471 | + 'livetranslate-special-button' => 'Spychere un aktualisiere', |
| 472 | + 'livetranslate-special-type' => 'Typ', |
| 473 | + 'livetranslate-special-location' => 'Ort', |
| 474 | + 'livetranslate-special-remove' => 'Uuseneh', |
| 475 | + 'livetranslate-special-local' => 'Lokal', |
| 476 | + 'livetranslate-special-add-tm' => 'E neje Ibersetzigsspycher aalege', |
| 477 | + 'livetranslate-special-current-tms' => 'Ibersetzigsspycher, wu s het', |
| 478 | + 'livetranslate-special-tms-update' => 'Ibersetzigsspycher aktualisiere', |
| 479 | + 'livetranslate-special-update' => 'Ibersetzigsspycher aktualisiere', |
| 480 | + 'livetranslate-importtms-param-miscmatch' => 'Missverhältnis zwische dr Aazahl vu Spycherplätz un Type', |
| 481 | +); |
| 482 | + |
| 483 | +/** Hebrew (עברית) |
| 484 | + * @author Amire80 |
| 485 | + */ |
| 486 | +$messages['he'] = array( |
| 487 | + 'livetranslate-desc' => 'הפעלת תרגום חי של תוכן הדף באמצעות שירות התרגום של גוגל', |
| 488 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|לשנות]] את רשימת זיכרונות התרגום', |
| 489 | + 'group-tmxadmin' => 'מנהלי TMX', |
| 490 | + 'group-tmxadmin-member' => 'מנהל TMX', |
| 491 | + 'grouppage-tmxadmin' => 'Project:מנהלי TMX', |
| 492 | + 'livetranslate-translate-to' => 'לתרגם דף זה ל', |
| 493 | + 'livetranslate-button-translate' => 'תרגום', |
| 494 | + 'livetranslate-button-translating' => 'מתבצע תרגום...', |
| 495 | + 'livetranslate-button-revert' => 'הצגת המקור', |
| 496 | + 'livetranslate-dictionary-error' => 'לא ניתן להשיג את מילון התרגום החי. מילים לא יטופלו כמיוחדות במהלך התרגום.', |
| 497 | + 'livetranslate-dictionary-empty' => 'במילון עדיין אין מילים. להוספה יש ללחות על "עריכה".', |
| 498 | + 'livetranslate-dictionary-count' => 'יש {{PLURAL:$1|מילה אחת|$1 מילים}} ב־{{PLURAL:$2|שפה אחת|$2 שפות}}. להוספה יש ללחוץ על "עריכה".', |
| 499 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|השפה הזאת אינה מוגדרת|השפות האלה אינן מוגדרות}} כעת כיעד לתרגום: $1. שנו השפות המאופשרות בהגדרות הוויקי שלכם או הוציאו אותן מהמילון.', |
| 500 | + 'livetranslate-dictionary-goto-edit' => 'שינוי זיכרונות תרגום.', |
| 501 | + 'special-livetranslate' => 'תרגום חי', |
| 502 | + 'livetranslate-tmtype-ltf' => 'תסדיר תרגום חי', |
| 503 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 504 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 505 | + 'livetranslate-special-no-tms-yet' => 'אין עדיין שום זיכרונות תרגום.', |
| 506 | + 'livetranslate-special-button' => 'שמירה ועדכון', |
| 507 | + 'livetranslate-special-type' => 'סוג', |
| 508 | + 'livetranslate-special-location' => 'מיקום', |
| 509 | + 'livetranslate-special-remove' => 'הסרה', |
| 510 | + 'livetranslate-special-local' => 'מקומי', |
| 511 | + 'livetranslate-special-add-tm' => 'הוסף זיכרון תרגום חדש', |
| 512 | + 'livetranslate-special-current-tms' => 'זיכרונות תרגום קיימים', |
| 513 | + 'livetranslate-special-tms-update' => 'עדכון זיכרונות תרגום', |
| 514 | + 'livetranslate-special-update' => 'עדכון זיכרונות תרגום', |
| 515 | + 'livetranslate-importtms-param-miscmatch' => 'מתאים בין מספר המיקומים למספר הסוגים', |
| 516 | +); |
| 517 | + |
| 518 | +/** Upper Sorbian (Hornjoserbsce) |
| 519 | + * @author Michawiki |
| 520 | + */ |
| 521 | +$messages['hsb'] = array( |
| 522 | + 'livetranslate-desc' => 'Zmóžnja hnydomne přełožowanje wobsaha strony z pomocu słužby "Google Translate"', |
| 523 | + 'livetranslate-translate-to' => 'Přełož tutu stronu do', |
| 524 | + 'livetranslate-button-translate' => 'Přełožić', |
| 525 | + 'livetranslate-button-translating' => 'Přełožuje so...', |
| 526 | + 'livetranslate-button-revert' => 'Original pokazać', |
| 527 | + 'livetranslate-dictionary-error' => 'Słownik za Live Translate njeda so začitać. Jeho słowa so za přełožowanski proces njewobkedźbuja.', |
| 528 | + 'livetranslate-dictionary-empty' => 'Hišće žane słowa w słowniku njejsu. Klikń na rajtark "wobdźěłać", zo by někotre přidał.', |
| 529 | + '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ł.', |
| 530 | + '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.', |
| 531 | + 'livetranslate-dictionary-goto-edit' => 'Pśełožowański składowak změniś.', |
| 532 | + 'special-livetranslate' => 'Live translate', |
| 533 | + 'livetranslate-tmtype-ltf' => 'Live Translate format', |
| 534 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 535 | + 'livetranslate-tmtype-gcsv' => 'Google-CSV', |
| 536 | + 'livetranslate-special-no-tms-yet' => 'Hišće přełožkowe składowaki njejsu.', |
| 537 | + 'livetranslate-special-button' => 'Składować a aktualizować', |
| 538 | + 'livetranslate-special-type' => 'Typ', |
| 539 | + 'livetranslate-special-location' => 'Městno', |
| 540 | + 'livetranslate-special-remove' => 'Wotstronić', |
| 541 | + 'livetranslate-special-local' => 'Lokalny', |
| 542 | + 'livetranslate-special-add-tm' => 'Nowy přełožkowy składowak přidać', |
| 543 | + 'livetranslate-special-current-tms' => 'Eksistowace přełožkowe składowaki', |
| 544 | + 'livetranslate-special-tms-update' => 'Přełožkowe składowaki aktualizować', |
| 545 | + 'livetranslate-special-update' => 'Přełožkowe składowaki aktualizować', |
| 546 | + 'livetranslate-importtms-param-miscmatch' => 'Njepoměr mjez ličbu městnow a typow', |
| 547 | +); |
| 548 | + |
| 549 | +/** Interlingua (Interlingua) |
| 550 | + * @author McDutchie |
| 551 | + */ |
| 552 | +$messages['ia'] = array( |
| 553 | + 'livetranslate-desc' => 'Permitte le traduction in directo de contento de paginas usante le servicio Google Translate', |
| 554 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modificar]] le lista de memorias de traduction', |
| 555 | + 'group-tmxadmin' => 'Administratores TMX', |
| 556 | + 'group-tmxadmin-member' => 'Administrator TMX', |
| 557 | + 'grouppage-tmxadmin' => 'Project:Administratores_TMX', |
| 558 | + 'livetranslate-translate-to' => 'Traducer iste pagina in', |
| 559 | + 'livetranslate-button-translate' => 'Traducer', |
| 560 | + 'livetranslate-button-translating' => 'Traduction in curso...', |
| 561 | + 'livetranslate-button-revert' => 'Monstrar original', |
| 562 | + 'livetranslate-dictionary-error' => 'Non poteva obtener le dictionario de traduction in directo. Nulle parola essera tractate como special durante le processo de traduction.', |
| 563 | + 'livetranslate-dictionary-empty' => 'Le dictionario non ha ancora parolas. Clicca sur le scheda "modificar" pro adder alcunes.', |
| 564 | + '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.', |
| 565 | + '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.', |
| 566 | + 'livetranslate-dictionary-goto-edit' => 'Modificar le memorias de traduction.', |
| 567 | + 'special-livetranslate' => 'Traduction in directo', |
| 568 | + 'livetranslate-tmtype-ltf' => 'Formato de traduction in directo', |
| 569 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 570 | + 'livetranslate-tmtype-gcsv' => 'CSV de Google', |
| 571 | + 'livetranslate-special-no-tms-yet' => 'Il non ha ancora memorias de traduction.', |
| 572 | + 'livetranslate-special-button' => 'Salveguardar e actualisar', |
| 573 | + 'livetranslate-special-type' => 'Typo', |
| 574 | + 'livetranslate-special-location' => 'Loco', |
| 575 | + 'livetranslate-special-remove' => 'Remover', |
| 576 | + 'livetranslate-special-local' => 'Local', |
| 577 | + 'livetranslate-special-add-tm' => 'Adder un nove memoria de traduction', |
| 578 | + 'livetranslate-special-current-tms' => 'Memorias de traduction existente', |
| 579 | + 'livetranslate-special-tms-update' => 'Actualisar memorias de traduction', |
| 580 | + 'livetranslate-special-update' => 'Actualisar memorias de traduction', |
| 581 | + 'livetranslate-importtms-param-miscmatch' => 'Le numero de locos differe del numero de typos', |
| 582 | +); |
| 583 | + |
| 584 | +/** Indonesian (Bahasa Indonesia) |
| 585 | + * @author IvanLanin |
| 586 | + */ |
| 587 | +$messages['id'] = array( |
| 588 | + 'livetranslate-desc' => 'Memungkinkan penerjemahan langsung konten halaman dengan menggunakan layanan Google Terjemahan', |
| 589 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Mengubah]] daftar memori terjemahan', |
| 590 | + 'livetranslate-translate-to' => 'Terjemahkan halaman ini ke', |
| 591 | + 'livetranslate-button-translate' => 'Terjemahkan', |
| 592 | + 'livetranslate-button-translating' => 'Menerjemahkan ...', |
| 593 | + 'livetranslate-button-revert' => 'Tampilkan yang asli', |
| 594 | + 'livetranslate-dictionary-error' => 'Tidak dapat memperoleh kamus penerjemahan langsung. Tidak ada kata yang diperlakukan secara khusus selama proses penerjemahan.', |
| 595 | + 'livetranslate-dictionary-empty' => 'Belum tersedia kata dalam kamus. Klik tab "sunting" untuk menambahkan.', |
| 596 | + 'livetranslate-dictionary-count' => 'Ada {{PLURAL:$1|$1 kata|$1 kata}} dalam $2 {{PLURAL:$2|bahasa|bahasa}}. Klik tab "sunting" untuk menambakan.', |
| 597 | + '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.', |
| 598 | + 'livetranslate-dictionary-goto-edit' => 'Modifikasi memori terjemahan.', |
| 599 | + 'special-livetranslate' => 'Terjemahan langsung', |
| 600 | + 'livetranslate-tmtype-ltf' => 'Format Terjemahan Langsung', |
| 601 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 602 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 603 | + 'livetranslate-special-no-tms-yet' => 'Memori terjemahan belum tersedia.', |
| 604 | + 'livetranslate-special-button' => 'Simpan dan perbarui', |
| 605 | + 'livetranslate-special-type' => 'Jenis', |
| 606 | + 'livetranslate-special-location' => 'Lokasi', |
| 607 | + 'livetranslate-special-remove' => 'Hapus', |
| 608 | + 'livetranslate-special-local' => 'Lokal', |
| 609 | + 'livetranslate-special-add-tm' => 'Tambahkan memori terjemahan baru', |
| 610 | + 'livetranslate-special-current-tms' => 'Memori terjemahan yang ada', |
| 611 | + 'livetranslate-special-tms-update' => 'Perbarui memori terjemahan', |
| 612 | + 'livetranslate-special-update' => 'Perbarui memori terjemahan', |
| 613 | + 'livetranslate-importtms-param-miscmatch' => 'Jumlah lokasi dan jenis tidak sesuai', |
| 614 | +); |
| 615 | + |
| 616 | +/** Italian (Italiano) |
| 617 | + * @author Beta16 |
| 618 | + */ |
| 619 | +$messages['it'] = array( |
| 620 | + 'livetranslate-button-translate' => 'Traduci', |
| 621 | + 'livetranslate-button-translating' => 'Traduzione in corso...', |
| 622 | +); |
| 623 | + |
| 624 | +/** Japanese (日本語) |
| 625 | + * @author Ohgi |
| 626 | + */ |
| 627 | +$messages['ja'] = array( |
| 628 | + 'livetranslate-translate-to' => 'このページを翻訳', |
| 629 | + 'livetranslate-button-translate' => '翻訳', |
| 630 | + 'livetranslate-button-translating' => '翻訳中...', |
| 631 | +); |
| 632 | + |
| 633 | +/** Colognian (Ripoarisch) |
| 634 | + * @author Purodha |
| 635 | + */ |
| 636 | +$messages['ksh'] = array( |
| 637 | + 'livetranslate-desc' => 'Määt en „{{int:special-livetranslate}}“ müjjelesch met <span class="plainlinks">[http://translate.google.com/ Google Translate]</span>.', |
| 638 | + 'livetranslate-translate-to' => 'Donn di Sigg heh op ', |
| 639 | + 'livetranslate-button-translate' => 'Övversätze!', |
| 640 | + 'livetranslate-button-translating' => 'Am Övversätze …', |
| 641 | + 'livetranslate-button-revert' => 'Ojinaal Shprooch aanzeije', |
| 642 | + 'livetranslate-dictionary-error' => 'Mer kunnte kein Wööterbooch fenge. Kei Woot weet beim Övversäze extra behandelt.', |
| 643 | + 'livetranslate-dictionary-empty' => 'Mer han noch kei Woot em Wööterbooch. |
| 644 | +Övver dä „{{int:edit}}“-Lengk kam_mer Wööter enjävve.', |
| 645 | + '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.', |
| 646 | + '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.', |
| 647 | + 'livetranslate-dictionary-goto-edit' => 'De Speicher för Övversäzunge ändere.', |
| 648 | + 'special-livetranslate' => 'Lebändesch Övversäze', |
| 649 | + 'livetranslate-tmtype-ltf' => '<i lang="en">Live-Translate</i>-Format', |
| 650 | + 'livetranslate-tmtype-tmx' => '<i lang="en">Translation Memory eXchange</i>', |
| 651 | + 'livetranslate-tmtype-gcsv' => '<i lang="en">Google-CSV</i>', |
| 652 | + 'livetranslate-special-no-tms-yet' => 'Mer han noch kein Speicher för Övversäzunge.', |
| 653 | + 'livetranslate-special-button' => 'Faßhallde un op ene neue Stand bränge', |
| 654 | + 'livetranslate-special-type' => 'Zoot', |
| 655 | + 'livetranslate-special-location' => 'Woh?', |
| 656 | + 'livetranslate-special-remove' => 'Nemm fott!', |
| 657 | + 'livetranslate-special-local' => 'Heh', |
| 658 | + 'livetranslate-special-add-tm' => 'Ene neue Speicher för Övversäzunge dobei donn', |
| 659 | + 'livetranslate-special-current-tms' => 'Speicher för Övversäzunge, di ald doh sin', |
| 660 | + 'livetranslate-special-tms-update' => 'Speicher för Övversäzunge op ene neue Stand bränge', |
| 661 | + 'livetranslate-special-update' => 'Speicher för Övversäzunge op ene neue Stand bränge', |
| 662 | + 'livetranslate-importtms-param-miscmatch' => 'De Aanzahl Speicherplätz un Zoote paß nit zosamme.', |
| 663 | +); |
| 664 | + |
| 665 | +/** Kurdish (Latin) (Kurdî (Latin)) |
| 666 | + * @author George Animal |
| 667 | + */ |
| 668 | +$messages['ku-latn'] = array( |
| 669 | + 'livetranslate-special-type' => 'Cure', |
| 670 | +); |
| 671 | + |
| 672 | +/** Luxembourgish (Lëtzebuergesch) |
| 673 | + * @author Robby |
| 674 | + */ |
| 675 | +$messages['lb'] = array( |
| 676 | + 'livetranslate-desc' => 'Erméiglecht d\'live Iwwersetzen vu Säiteninhalt mam Service "Google Translate"', |
| 677 | + 'right-managetms' => "[[Special:SpecialLiveTranslate|Ännert]] d'Lëscht vun Iwwersetzungen am Späicher", |
| 678 | + 'group-tmxadmin' => 'TMX-Administrateuren', |
| 679 | + 'group-tmxadmin-member' => 'TMX-Administrateur', |
| 680 | + 'grouppage-tmxadmin' => 'Project:TMX-Administrateuren', |
| 681 | + 'livetranslate-translate-to' => 'Iwwersetzt dës Säit op', |
| 682 | + 'livetranslate-button-translate' => 'Iwwersetzen', |
| 683 | + 'livetranslate-button-translating' => 'Iwwersetzen...', |
| 684 | + 'livetranslate-button-revert' => "D'Original weisen", |
| 685 | + 'livetranslate-dictionary-error' => 'De Live-Iwwersetzungs-Dictionnaire gouf net fonnt. Keng Wierder gi bei der Iwwersetzung als spezial ugekuckt.', |
| 686 | + 'livetranslate-dictionary-empty' => 'Et gëtt nach keng Wierder am Dictionnaire. Klickt op den "Änneren"-Tab fir der derbäizesetzen.', |
| 687 | + '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.', |
| 688 | + '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.", |
| 689 | + 'livetranslate-dictionary-goto-edit' => 'Den Iwwersetzungsspäicher änneren.', |
| 690 | + 'special-livetranslate' => 'Live iwwersetzen', |
| 691 | + 'livetranslate-tmtype-ltf' => 'Live Translate Format', |
| 692 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 693 | + 'livetranslate-tmtype-gcsv' => 'Google-CSV', |
| 694 | + 'livetranslate-special-no-tms-yet' => 'Et gëtt elo nach keen Iwwersetzungsspäicher.', |
| 695 | + 'livetranslate-special-button' => 'Späicheren an aktualiséieren', |
| 696 | + 'livetranslate-special-type' => 'Typ', |
| 697 | + 'livetranslate-special-location' => 'Plaz', |
| 698 | + 'livetranslate-special-remove' => 'Ewechhuelen', |
| 699 | + 'livetranslate-special-local' => 'Lokal', |
| 700 | + 'livetranslate-special-add-tm' => 'En neien Iwwersetzungsspäicher derbäisetzen', |
| 701 | + 'livetranslate-special-current-tms' => 'Aktuell Iwwersetzungsspäicheren', |
| 702 | + 'livetranslate-special-tms-update' => 'Den Iwwersetzungsspäicher aktualiséieren.', |
| 703 | + 'livetranslate-special-update' => 'Den Iwwersetzungsspäicher aktualiséieren.', |
| 704 | + 'livetranslate-importtms-param-miscmatch' => 'Duercherneen tëschent der Zuel vu Plazen an Typen', |
| 705 | +); |
| 706 | + |
| 707 | +/** Macedonian (Македонски) |
| 708 | + * @author Bjankuloski06 |
| 709 | + */ |
| 710 | +$messages['mk'] = array( |
| 711 | + 'livetranslate-desc' => 'Овозможува преведување на содржината на една страница во живо, користејќи Google Translate', |
| 712 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Менување]] на списокот на преводни памтила', |
| 713 | + 'group-tmxadmin' => 'Администратори на TMX', |
| 714 | + 'group-tmxadmin-member' => 'Администратор на TMX', |
| 715 | + 'grouppage-tmxadmin' => 'Project:Админи_на_TMX', |
| 716 | + 'livetranslate-translate-to' => 'Преведи ја страницава на', |
| 717 | + 'livetranslate-button-translate' => 'Преведи', |
| 718 | + 'livetranslate-button-translating' => 'Преведувам...', |
| 719 | + 'livetranslate-button-revert' => 'Прикажи изворно', |
| 720 | + 'livetranslate-dictionary-error' => 'Не можев да го добијам речникот за преведување во живо. Ниеден збор нема да се смета за посебен во текот на преводната постапка.', |
| 721 | + 'livetranslate-dictionary-empty' => 'Сè уште нема зборови во речникот. Стиснете на јазичето „уреди“ и додајте некои.', |
| 722 | + 'livetranslate-dictionary-count' => 'Има {{PLURAL:$1|$1 збор|$1 збора}} на $2 {{PLURAL:$2|јазик|јазици}}. Ситиснете на јазичето „уреди“ за да додадете уште.', |
| 723 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Овој јазик моментално не е зададен|Овие јазици моментално не се зададени}} како допуштена преводна одредница: $1. Изменете ги допуштените јазици во вики-поставките, или пак отстранете ги постоечкиве од речникот.', |
| 724 | + 'livetranslate-dictionary-goto-edit' => 'Измени ги преводните памтила.', |
| 725 | + 'special-livetranslate' => 'Преведување во живо', |
| 726 | + 'livetranslate-tmtype-ltf' => 'Формат на преведувањето во живо', |
| 727 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 728 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 729 | + 'livetranslate-special-no-tms-yet' => 'Сè уште нема преводни памтила', |
| 730 | + 'livetranslate-special-button' => 'Зачувај и поднови', |
| 731 | + 'livetranslate-special-type' => 'Тип', |
| 732 | + 'livetranslate-special-location' => 'Место', |
| 733 | + 'livetranslate-special-remove' => 'Отстрани', |
| 734 | + 'livetranslate-special-local' => 'Локално', |
| 735 | + 'livetranslate-special-add-tm' => 'Додај ново преводно памтило', |
| 736 | + 'livetranslate-special-current-tms' => 'Постоечки преводни памтила', |
| 737 | + 'livetranslate-special-tms-update' => 'Поднови преводни памтила', |
| 738 | + 'livetranslate-special-update' => 'Поднови преводни памтила', |
| 739 | + 'livetranslate-importtms-param-miscmatch' => 'Бројот на местата и бројот на типовите не се совпаѓаат', |
| 740 | +); |
| 741 | + |
| 742 | +/** Malay (Bahasa Melayu) |
| 743 | + * @author Anakmalaysia |
| 744 | + */ |
| 745 | +$messages['ms'] = array( |
| 746 | + 'livetranslate-desc' => 'Membolehkan penterjemahan kandungan laman secara langsung dengan menggunakan khidmat Google Translate', |
| 747 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Ubah suai]] senarai ingatan terjemahan', |
| 748 | + 'group-tmxadmin' => 'Pentadbir TMX', |
| 749 | + 'group-tmxadmin-member' => 'Pentadbir TMX', |
| 750 | + 'grouppage-tmxadmin' => 'Project:TMX_admins', |
| 751 | + 'livetranslate-translate-to' => 'Terjemahkan laman ini kepada', |
| 752 | + 'livetranslate-button-translate' => 'Terjemah', |
| 753 | + 'livetranslate-button-translating' => 'Menterjemah...', |
| 754 | + 'livetranslate-button-revert' => 'Tunjukkan yang asal', |
| 755 | + 'livetranslate-dictionary-error' => 'Kamus penterjemahan langsung tidak boleh diperoleh. Tiada perkataan yang akan diberi layanan khas dalam proses penterjemahan.', |
| 756 | + 'livetranslate-dictionary-empty' => 'Dalam kamus belum ada kata-kata. Klik tab "sunting" untuk mengisikan kata-kata.', |
| 757 | + 'livetranslate-dictionary-count' => 'Terdapat $1 patah kata dalam $2 bahasa. Klib tab "sunting" untuk menambah kata.', |
| 758 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Bahasa|Bahasa-bahasa}} ini kini tidak ditetapkan sebagai sasaran terjemahan yang dibenarkan: $1. Ubah suai bahasa yang dibenarkan pada konfigurasi wiki anda, atau gugurkannya daripada kamus.', |
| 759 | + 'livetranslate-dictionary-goto-edit' => 'Ubah suai ingatan terjemahan.', |
| 760 | + 'special-livetranslate' => 'Penterjemahan langsung', |
| 761 | + 'livetranslate-tmtype-ltf' => 'Format Penterjemahan Langsung', |
| 762 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 763 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 764 | + 'livetranslate-special-no-tms-yet' => 'Belum ada ingatan penterjemahan.', |
| 765 | + 'livetranslate-special-button' => 'Simpan dan kemas kini', |
| 766 | + 'livetranslate-special-type' => 'Jenis', |
| 767 | + 'livetranslate-special-location' => 'Lokasi', |
| 768 | + 'livetranslate-special-remove' => 'Buang', |
| 769 | + 'livetranslate-special-local' => 'Tempatan', |
| 770 | + 'livetranslate-special-add-tm' => 'Tambahkan ingatan terjemahan baru', |
| 771 | + 'livetranslate-special-current-tms' => 'Ingatan terjemahan sedia ada', |
| 772 | + 'livetranslate-special-tms-update' => 'Kemas kini ingatan terjemahan', |
| 773 | + 'livetranslate-special-update' => 'Kemas kini ingatan terjemahan', |
| 774 | + 'livetranslate-importtms-param-miscmatch' => 'Salah padan antara jumlah lokasi dan jenis', |
| 775 | +); |
| 776 | + |
| 777 | +/** Dutch (Nederlands) |
| 778 | + * @author McDutchie |
| 779 | + * @author SPQRobin |
| 780 | + * @author Siebrand |
| 781 | + */ |
| 782 | +$messages['nl'] = array( |
| 783 | + 'livetranslate-desc' => 'Maakt het mogelijk paginainhoud live te vertalen met behulp van de dienst Google Translate', |
| 784 | + 'right-managetms' => 'De lijst met vertaalgeheugens [[Special:SpecialLiveTranslate|wijzigen]]', |
| 785 | + 'group-tmxadmin' => 'TMX-beheerders', |
| 786 | + 'group-tmxadmin-member' => 'TMX-beheerder', |
| 787 | + 'grouppage-tmxadmin' => 'Project:TMX-beheerders', |
| 788 | + 'livetranslate-translate-to' => 'Pagina vertalen in het', |
| 789 | + 'livetranslate-button-translate' => 'Vertalen', |
| 790 | + 'livetranslate-button-translating' => 'Bezig met vertalen...', |
| 791 | + 'livetranslate-button-revert' => 'Origineel weergeven', |
| 792 | + '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.', |
| 793 | + 'livetranslate-dictionary-empty' => 'Er zijn nog geen woorden in het woordenboek. Klik op de tab "bewerken" om woorden toe te voegen.', |
| 794 | + '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.', |
| 795 | + '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.', |
| 796 | + 'livetranslate-dictionary-goto-edit' => 'Vertaalgeheugens wijzigen.', |
| 797 | + 'special-livetranslate' => 'Live vertalen', |
| 798 | + 'livetranslate-tmtype-ltf' => 'Live Vertalen-opmaak', |
| 799 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 800 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 801 | + 'livetranslate-special-no-tms-yet' => 'Er zijn nog geen vertaalgeheugens.', |
| 802 | + 'livetranslate-special-button' => 'Opslaan en bijwerken', |
| 803 | + 'livetranslate-special-type' => 'Type', |
| 804 | + 'livetranslate-special-location' => 'Locatie', |
| 805 | + 'livetranslate-special-remove' => 'Verwijderen', |
| 806 | + 'livetranslate-special-local' => 'Lokaal', |
| 807 | + 'livetranslate-special-add-tm' => 'Nieuw vertaalgeheugen toevoegen', |
| 808 | + 'livetranslate-special-current-tms' => 'Bestaande vertaalgeheugens', |
| 809 | + 'livetranslate-special-tms-update' => 'Vertaalgeheugens bijwerken', |
| 810 | + 'livetranslate-special-update' => 'Vertaalgeheugens bijwerken', |
| 811 | + 'livetranslate-importtms-param-miscmatch' => 'Er is een verschil tussen het aantal locaties en typen', |
| 812 | +); |
| 813 | + |
| 814 | +/** Norwegian (bokmål) (Norsk (bokmål)) |
| 815 | + * @author Nghtwlkr |
| 816 | + */ |
| 817 | +$messages['no'] = array( |
| 818 | + 'livetranslate-desc' => 'Aktiverer live-oversettelse av sideinnhold ved hjelp av tjenesten Google Translate', |
| 819 | + 'livetranslate-translate-to' => 'Oversett denne siden til', |
| 820 | + 'livetranslate-button-translate' => 'Oversett', |
| 821 | + 'livetranslate-button-translating' => 'Oversetter...', |
| 822 | + 'livetranslate-button-revert' => 'Vis opprinnelig', |
| 823 | + 'livetranslate-dictionary-error' => 'Kunne ikke få tak i sanntidsoversettelsesordlisten. Ingen ord vil bli behandlet som spesielle under oversettelsesprosessen.', |
| 824 | + 'livetranslate-dictionary-empty' => 'Det er ingen ord i ordlisten ennå. Klikk på «rediger»-fanen for å legge til noen.', |
| 825 | + '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.', |
| 826 | + '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.', |
| 827 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 828 | + 'livetranslate-special-button' => 'Lagre og oppdater', |
| 829 | + 'livetranslate-special-type' => 'Type', |
| 830 | + 'livetranslate-special-location' => 'Plassering', |
| 831 | + 'livetranslate-special-remove' => 'Fjern', |
| 832 | + 'livetranslate-special-local' => 'Lokal', |
| 833 | + 'livetranslate-special-add-tm' => 'Legg til et nytt oversettelsesminne', |
| 834 | + 'livetranslate-special-current-tms' => 'Eksisterende oversettelsesminner', |
| 835 | + 'livetranslate-special-tms-update' => 'Oppdater oversettelsesminner', |
| 836 | + 'livetranslate-special-update' => 'Oppdater oversettelsesminner', |
| 837 | + 'livetranslate-importtms-param-miscmatch' => 'Avvik mellom antall plasseringer og typer', |
| 838 | +); |
| 839 | + |
| 840 | +/** Polish (Polski) |
| 841 | + * @author Byulent |
| 842 | + * @author Sp5uhe |
| 843 | + * @author Woytecr |
| 844 | + */ |
| 845 | +$messages['pl'] = array( |
| 846 | + 'livetranslate-desc' => 'Włącza tłumaczenie zawartości strony na żywo z wykorzystaniem serwisu tłumaczącego Google', |
| 847 | + 'livetranslate-translate-to' => 'Przetłumacz tę stronę na', |
| 848 | + 'livetranslate-button-translate' => 'Tłumacz', |
| 849 | + 'livetranslate-button-translating' => 'Tłumaczenie...', |
| 850 | + 'livetranslate-button-revert' => 'Pokaż w oryginale', |
| 851 | + '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.', |
| 852 | + 'livetranslate-dictionary-empty' => 'Na razie brak jest jeszcze słów w słowniku. Kliknij zakładkę „Edytuj“ aby jakieś dodać.', |
| 853 | + '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.', |
| 854 | + '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.', |
| 855 | + 'livetranslate-special-type' => 'Typ', |
| 856 | + 'livetranslate-special-remove' => 'Usuń', |
| 857 | +); |
| 858 | + |
| 859 | +/** Piedmontese (Piemontèis) |
| 860 | + * @author Borichèt |
| 861 | + * @author Dragonòt |
| 862 | + */ |
| 863 | +$messages['pms'] = array( |
| 864 | + 'livetranslate-desc' => 'A abìlita la tradussion imedià dël contnù ëd la pàgina an dovrand ël sërvissi ëd tradussion ëd Google', |
| 865 | + 'livetranslate-translate-to' => 'Vòlta sta pàgina an', |
| 866 | + 'livetranslate-button-translate' => 'Traduv', |
| 867 | + 'livetranslate-button-translating' => 'Volté...', |
| 868 | + 'livetranslate-button-revert' => "Mostré l'original", |
| 869 | + '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.', |
| 870 | + 'livetranslate-dictionary-empty' => 'A-i é pa anco\' gnun-e paròle ant ël dissionari. Sgnaca ël boton "modìfica" për giuntene quaidun-e.', |
| 871 | + '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.', |
| 872 | + '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.", |
| 873 | + 'livetranslate-dictionary-goto-edit' => 'Modifiché le memòrie ëd tradussion.', |
| 874 | + 'special-livetranslate' => 'Tradussion dal viv', |
| 875 | + 'livetranslate-tmtype-ltf' => 'Formà ëd Live Translate', |
| 876 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 877 | + 'livetranslate-tmtype-gcsv' => 'CSV ëd Google', |
| 878 | + 'livetranslate-special-no-tms-yet' => 'A-i é pa ancor gnun-a memòria ëd tradussion.', |
| 879 | + 'livetranslate-special-button' => 'Salva e modìfica', |
| 880 | + 'livetranslate-special-type' => 'Sòrt', |
| 881 | + 'livetranslate-special-location' => 'Locassion', |
| 882 | + 'livetranslate-special-remove' => 'Gava', |
| 883 | + 'livetranslate-special-local' => 'Local', |
| 884 | + 'livetranslate-special-add-tm' => 'Gionté na neuva memòria ëd tradussion', |
| 885 | + 'livetranslate-special-current-tms' => 'Memòrie ëd tradussion esistente', |
| 886 | + 'livetranslate-special-tms-update' => 'Agiornament ëd memòrie ëd tradussion', |
| 887 | + 'livetranslate-special-update' => 'Agiornament ëd memòrie ëd tradussion', |
| 888 | + 'livetranslate-importtms-param-miscmatch' => 'Discordansa tra la quantità ëd locassion e le sòrt', |
| 889 | +); |
| 890 | + |
| 891 | +/** Pashto (پښتو) |
| 892 | + * @author Ahmed-Najib-Biabani-Ibrahimkhel |
| 893 | + */ |
| 894 | +$messages['ps'] = array( |
| 895 | + 'livetranslate-button-translate' => 'ژباړل', |
| 896 | + 'livetranslate-button-translating' => 'د ژباړې په حال کې...', |
| 897 | + 'livetranslate-special-location' => 'ځای', |
| 898 | + 'livetranslate-special-local' => 'سيمه ايز', |
| 899 | +); |
| 900 | + |
| 901 | +/** Portuguese (Português) |
| 902 | + * @author Hamilton Abreu |
| 903 | + */ |
| 904 | +$messages['pt'] = array( |
| 905 | + 'livetranslate-desc' => 'Permite a tradução imediata do conteúdo das páginas usando o serviço Google Translate', |
| 906 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|Modificar]] a lista de memórias de tradução', |
| 907 | + 'group-tmxadmin' => 'Administradores TMX', |
| 908 | + 'group-tmxadmin-member' => 'Administrador TMX', |
| 909 | + 'grouppage-tmxadmin' => 'Project:Administradores_TMX', |
| 910 | + 'livetranslate-translate-to' => 'Traduzir esta página para', |
| 911 | + 'livetranslate-button-translate' => 'Traduzir', |
| 912 | + 'livetranslate-button-translating' => 'A traduzir...', |
| 913 | + 'livetranslate-button-revert' => 'Mostrar original', |
| 914 | + '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.', |
| 915 | + 'livetranslate-dictionary-empty' => 'Ainda não existem palavras no dicionário. Clique o separador "editar" para adicionar algumas.', |
| 916 | + '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.', |
| 917 | + '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.', |
| 918 | + 'livetranslate-dictionary-goto-edit' => 'Modificar as memórias de tradução.', |
| 919 | + 'special-livetranslate' => 'Tradução ao vivo', |
| 920 | + 'livetranslate-tmtype-ltf' => 'Formato de Tradução ao Vivo', |
| 921 | + 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange', |
| 922 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 923 | + 'livetranslate-special-no-tms-yet' => 'Ainda não há nenhuma memória de tradução.', |
| 924 | + 'livetranslate-special-button' => 'Gravar e actualizar', |
| 925 | + 'livetranslate-special-type' => 'Tipo', |
| 926 | + 'livetranslate-special-location' => 'Localização', |
| 927 | + 'livetranslate-special-remove' => 'Remover', |
| 928 | + 'livetranslate-special-local' => 'Local', |
| 929 | + 'livetranslate-special-add-tm' => 'Adicionar uma memória de tradução nova', |
| 930 | + 'livetranslate-special-current-tms' => 'Memórias de tradução existentes', |
| 931 | + 'livetranslate-special-tms-update' => 'Actualizar memórias de tradução', |
| 932 | + 'livetranslate-special-update' => 'Actualizar memórias de tradução', |
| 933 | + 'livetranslate-importtms-param-miscmatch' => 'Discordância entre a quantidade de locais e tipos', |
| 934 | +); |
| 935 | + |
| 936 | +/** Brazilian Portuguese (Português do Brasil) |
| 937 | + * @author Giro720 |
| 938 | + */ |
| 939 | +$messages['pt-br'] = array( |
| 940 | + 'livetranslate-desc' => 'Permite a tradução imediata do conteúdo das páginas usando o serviço Google Translate', |
| 941 | + 'livetranslate-translate-to' => 'Traduzir esta página para', |
| 942 | + 'livetranslate-button-translate' => 'Traduzir', |
| 943 | + 'livetranslate-button-translating' => 'Traduzindo...', |
| 944 | +); |
| 945 | + |
| 946 | +/** Russian (Русский) |
| 947 | + * @author Byulent |
| 948 | + * @author Kaganer |
| 949 | + * @author MaxSem |
| 950 | + * @author Александр Сигачёв |
| 951 | + */ |
| 952 | +$messages['ru'] = array( |
| 953 | + 'livetranslate-desc' => 'Включает перевод текста страницы на лету с помощью службы переводов Google', |
| 954 | + 'right-managetms' => '[[Special:SpecialLiveTranslate|изменять]] список памяти переводов', |
| 955 | + 'group-tmxadmin' => 'Администраторы TMX', |
| 956 | + 'group-tmxadmin-member' => 'Администратор TMX', |
| 957 | + 'grouppage-tmxadmin' => 'Project:TMX-админы', |
| 958 | + 'livetranslate-translate-to' => 'Перевести эту страницу на', |
| 959 | + 'livetranslate-button-translate' => 'Перевести', |
| 960 | + 'livetranslate-button-translating' => 'Выполняется перевод...', |
| 961 | + 'livetranslate-button-revert' => 'Показать оригинал', |
| 962 | + 'livetranslate-dictionary-error' => 'Не удалось получить словарь живого перевода. Нет слов, которые будут рассматриваться как специальные во время процесса перевода.', |
| 963 | + 'livetranslate-dictionary-empty' => 'В словаре ещё нет слов. Нажмите «править», чтобы добавить несколько.', |
| 964 | + 'livetranslate-dictionary-count' => '$1 {{PLURAL:$1|слово|слова|слов}} на $2 {{PLURAL:$2|языке|языках|языках}}. Нажмите «править», чтобы добавить ещё.', |
| 965 | + 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|Этот язык|Эти языки}} не разрешено использовать в качестве цели перевода: $1. Измените разрешения в настройках вашей вики, или удалите их из словаря.', |
| 966 | + 'livetranslate-dictionary-goto-edit' => 'Изменение памяти переводов.', |
| 967 | + 'special-livetranslate' => 'Перевод на лету', |
| 968 | + 'livetranslate-tmtype-ltf' => 'Формат перевода на лету', |
| 969 | + 'livetranslate-tmtype-tmx' => 'Обмен памятью перевода', |
| 970 | + 'livetranslate-tmtype-gcsv' => 'Google CSV', |
| 971 | + 'livetranslate-special-no-tms-yet' => 'Памяти переводов пока нет.', |
| 972 | + 'livetranslate-special-button' => 'Сохранить и обновить', |
| 973 | + 'livetranslate-special-type' => 'Тип', |
| 974 | + 'livetranslate-special-location' => 'Расположение', |
| 975 | + 'livetranslate-special-remove' => 'Удалить', |
| 976 | + 'livetranslate-special-local' => 'Местное', |
| 977 | + 'livetranslate-special-add-tm' => 'Добавить новую память переводов', |
| 978 | + 'livetranslate-special-current-tms' => 'Существующие памяти переводов', |
| 979 | + 'livetranslate-special-tms-update' => 'Обновление памяти переводов', |
| 980 | + 'livetranslate-special-update' => 'Обновление памяти переводов', |
| 981 | + 'livetranslate-importtms-param-miscmatch' => 'Несоответствие количества расположений и типов', |
| 982 | +); |
| 983 | + |
| 984 | +/** Swedish (Svenska) |
| 985 | + * @author WikiPhoenix |
| 986 | + */ |
| 987 | +$messages['sv'] = array( |
| 988 | + 'livetranslate-translate-to' => 'Översätt den här sidan till', |
| 989 | + 'livetranslate-button-translate' => 'Översätt', |
| 990 | + 'livetranslate-button-translating' => 'Översätter...', |
| 991 | + 'livetranslate-button-revert' => 'Visa originaltexten', |
| 992 | + 'livetranslate-dictionary-empty' => 'Det finns inga ord i ordboken ännu. Klicka på fliken "redigera" för att lägga till.', |
| 993 | + '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.', |
| 994 | + 'livetranslate-dictionary-goto-edit' => 'Ändra översättningsminnena.', |
| 995 | + 'livetranslate-special-no-tms-yet' => 'Det finns inga översättningsminnen ännu.', |
| 996 | + 'livetranslate-special-button' => 'Spara och uppdatera', |
| 997 | + 'livetranslate-special-type' => 'Typ', |
| 998 | + 'livetranslate-special-location' => 'Plats', |
| 999 | + 'livetranslate-special-remove' => 'Ta bort', |
| 1000 | + 'livetranslate-special-local' => 'Lokal', |
| 1001 | + 'livetranslate-special-add-tm' => 'Lägg till ett nytt översättningsminne', |
| 1002 | + 'livetranslate-special-tms-update' => 'Uppdatera översättningsminnen', |
| 1003 | + 'livetranslate-special-update' => 'Uppdatera översättningsminnen', |
| 1004 | +); |
| 1005 | + |
| 1006 | +/** Telugu (తెలుగు) |
| 1007 | + * @author Veeven |
| 1008 | + */ |
| 1009 | +$messages['te'] = array( |
| 1010 | + 'livetranslate-translate-to' => 'ఈ పుటని అనువదించండి', |
| 1011 | + 'livetranslate-button-translate' => 'అనువదించు', |
| 1012 | + 'livetranslate-button-translating' => 'అనువదిస్తున్నాం...', |
| 1013 | + 'livetranslate-special-type' => 'రకం', |
| 1014 | + 'livetranslate-special-location' => 'ప్రాంతం', |
| 1015 | +); |
| 1016 | + |
| 1017 | +/** Tetum (Tetun) |
| 1018 | + * @author MF-Warburg |
| 1019 | + */ |
| 1020 | +$messages['tet'] = array( |
| 1021 | + 'livetranslate-special-remove' => 'Hasai', |
| 1022 | +); |
| 1023 | + |
| 1024 | +/** Tagalog (Tagalog) |
| 1025 | + * @author AnakngAraw |
| 1026 | + */ |
| 1027 | +$messages['tl'] = array( |
| 1028 | + 'livetranslate-desc' => 'Nagpapagana ng buhay na pagsasalinwika ng nilalaman ng pahina na ginagamit ang palingkurang Google Translate', |
| 1029 | + 'livetranslate-translate-to' => 'Isalinwika ang pahinang ito upang maging', |
| 1030 | + 'livetranslate-button-translate' => 'Isalinwika', |
| 1031 | + 'livetranslate-button-translating' => 'Isinasalinwika...', |
| 1032 | + 'livetranslate-button-revert' => 'Ipakita ang orihinal', |
| 1033 | + 'livetranslate-dictionary-error' => 'Hindi makamtan ang talahuluganan ng buhay na pagsasalinwika. Walang mga salitang ituturing na natatangi habang isinasagawa ang pagsasalinwika.', |
| 1034 | + 'livetranslate-dictionary-empty' => 'Walang mga salita sa loob ng talahuluganan. Pindutin ang laylayan na "baguhin" upang makapagdagdag ng ilan.', |
| 1035 | + '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.', |
| 1036 | + '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.', |
| 1037 | + 'livetranslate-dictionary-goto-edit' => 'Baguhin ang mga alaala ng pagsasalinwika.', |
| 1038 | + 'special-livetranslate' => 'Buhay na isalinwika', |
| 1039 | + 'livetranslate-tmtype-ltf' => 'Anyo ng Buhay na Pagsasalinwika', |
| 1040 | + 'livetranslate-tmtype-tmx' => 'Pagpapalitan ng Alaala ng Pagsasalinwika', |
| 1041 | + 'livetranslate-tmtype-gcsv' => 'CSV ng Google', |
| 1042 | + 'livetranslate-special-no-tms-yet' => 'Wala pang mga alaala ng pagsasalinwika.', |
| 1043 | + 'livetranslate-special-button' => 'Sagipin at isapanahon', |
| 1044 | + 'livetranslate-special-type' => 'Uri', |
| 1045 | + 'livetranslate-special-location' => 'Kinalalagyan', |
| 1046 | + 'livetranslate-special-remove' => 'Alisin', |
| 1047 | + 'livetranslate-special-local' => 'Katutubo', |
| 1048 | + 'livetranslate-special-add-tm' => 'Magdagdag ng isang bagong alaala ng pagsasalinwika', |
| 1049 | + 'livetranslate-special-current-tms' => 'Umiiral na mga alaala ng pagsasalinwika', |
| 1050 | + 'livetranslate-special-tms-update' => 'Isapanahon ang mga alaala ng pagsasalinwika', |
| 1051 | + 'livetranslate-special-update' => 'Isapanahon ang mga alaala ng pagsasalinwika', |
| 1052 | + 'livetranslate-importtms-param-miscmatch' => 'Hindi pagtutugma sa pagitan ng halaga ng mga kinalalagyan at mga uri', |
| 1053 | +); |
| 1054 | + |
| 1055 | +/** Ukrainian (Українська) |
| 1056 | + * @author Тест |
| 1057 | + */ |
| 1058 | +$messages['uk'] = array( |
| 1059 | + 'livetranslate-desc' => 'Робить можливим безпосередній переклад вмісту сторінки за допомогою служби Google Translate', |
| 1060 | + 'livetranslate-translate-to' => 'Перекласти цю сторінку', |
| 1061 | + 'livetranslate-button-translate' => 'Перекласти', |
| 1062 | + 'livetranslate-button-translating' => 'Перекладаю...', |
| 1063 | + 'livetranslate-button-revert' => 'Показати оригінал', |
| 1064 | + 'livetranslate-special-button' => 'Зберегти та оновити', |
| 1065 | + 'livetranslate-special-type' => 'Тип', |
| 1066 | + 'livetranslate-special-location' => 'Розташування', |
| 1067 | + 'livetranslate-special-remove' => 'Вилучити', |
| 1068 | +); |
| 1069 | + |
| 1070 | +/** Simplified Chinese (中文(简体)) |
| 1071 | + * @author Hydra |
| 1072 | + */ |
| 1073 | +$messages['zh-hans'] = array( |
| 1074 | + 'livetranslate-button-translate' => '翻译', |
| 1075 | + 'livetranslate-button-translating' => '翻译中。。。', |
| 1076 | + 'livetranslate-button-revert' => '显示原文', |
| 1077 | + 'livetranslate-dictionary-goto-edit' => '修改的翻译记忆库。', |
| 1078 | + 'special-livetranslate' => '实时翻译', |
| 1079 | + 'livetranslate-tmtype-ltf' => '实时翻译格式', |
| 1080 | + 'livetranslate-tmtype-tmx' => '翻译库交换', |
| 1081 | + 'livetranslate-tmtype-gcsv' => '谷歌 CSV', |
| 1082 | + 'livetranslate-special-no-tms-yet' => '但没有翻译记忆库。', |
| 1083 | + 'livetranslate-special-button' => '保存与更新', |
| 1084 | + 'livetranslate-special-type' => '类型', |
| 1085 | + 'livetranslate-special-location' => '位置', |
| 1086 | + 'livetranslate-special-remove' => '删除', |
| 1087 | + 'livetranslate-special-local' => '本地', |
| 1088 | + 'livetranslate-special-add-tm' => '添加一个新翻译记忆', |
| 1089 | + 'livetranslate-special-current-tms' => '现有的翻译记忆库', |
| 1090 | + 'livetranslate-special-tms-update' => '更新翻译记忆库', |
| 1091 | + 'livetranslate-special-update' => '更新翻译记忆库', |
| 1092 | + 'livetranslate-importtms-param-miscmatch' => '之间的位置的数量和类型不匹配', |
| 1093 | +); |
| 1094 | + |
| 1095 | +/** Traditional Chinese (中文(繁體)) |
| 1096 | + * @author Mark85296341 |
| 1097 | + */ |
| 1098 | +$messages['zh-hant'] = array( |
| 1099 | + 'livetranslate-translate-to' => '翻譯此頁', |
| 1100 | + 'livetranslate-button-translate' => '翻譯', |
| 1101 | + 'livetranslate-special-button' => '儲存和更新', |
| 1102 | + 'livetranslate-special-type' => '類型', |
| 1103 | + 'livetranslate-special-location' => '位置', |
| 1104 | + 'livetranslate-special-remove' => '移除', |
| 1105 | + 'livetranslate-special-local' => '地點', |
| 1106 | + 'livetranslate-special-add-tm' => '增加一個新的翻譯記憶', |
| 1107 | + 'livetranslate-special-current-tms' => '現有的翻譯記憶', |
| 1108 | + 'livetranslate-special-tms-update' => '更新翻譯記憶', |
| 1109 | + 'livetranslate-special-update' => '更新翻譯記憶', |
| 1110 | +); |
| 1111 | + |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 1112 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate.php |
— | — | @@ -0,0 +1,144 @@ |
| 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.2.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 | +$wgExtensionAliasesFiles['LiveTranslate'] = $egLiveTranslateIP . '/LiveTranslate.i18n.alias.php'; |
| 48 | +$wgExtensionMessagesFiles['LiveTranslateMagic'] = $egLiveTranslateIP . '/LiveTranslate.i18n.magic.php'; |
| 49 | + |
| 50 | +$wgAutoloadClasses['LiveTranslateHooks'] = $egLiveTranslateIP . '/LiveTranslate.hooks.php'; |
| 51 | +$wgAutoloadClasses['ApiImportTranslationMemories'] = $egLiveTranslateIP . '/api/ApiImportTranslationMemories.php'; |
| 52 | +$wgAutoloadClasses['ApiLiveTranslate'] = $egLiveTranslateIP . '/api/ApiLiveTranslate.php'; |
| 53 | +$wgAutoloadClasses['ApiQueryLiveTranslate'] = $egLiveTranslateIP . '/api/ApiQueryLiveTranslate.php'; |
| 54 | +$wgAutoloadClasses['ApiQueryTranslationMemories'] = $egLiveTranslateIP . '/api/ApiQueryTranslationMemories.php'; |
| 55 | + |
| 56 | +$incDirIP = $egLiveTranslateIP . '/includes/'; |
| 57 | +$wgAutoloadClasses['LiveTranslateFunctions'] = $incDirIP . 'LiveTranslate_Functions.php'; |
| 58 | +$wgAutoloadClasses['LTGCSVParser'] = $incDirIP . 'LT_GCSVParser.php'; |
| 59 | +$wgAutoloadClasses['LTLTFParser'] = $incDirIP . 'LT_LTFParser.php'; |
| 60 | +$wgAutoloadClasses['LTTMParser'] = $incDirIP . 'LT_TMParser.php'; |
| 61 | +$wgAutoloadClasses['LTTMUnit'] = $incDirIP . 'LT_TMUnit.php'; |
| 62 | +$wgAutoloadClasses['LTTMXParser'] = $incDirIP . 'LT_TMXParser.php'; |
| 63 | +$wgAutoloadClasses['LTTranslationMemory'] = $incDirIP . 'LT_TranslationMemory.php'; |
| 64 | +unset( $incDirIP ); |
| 65 | + |
| 66 | +$wgAutoloadClasses['SpecialLiveTranslate'] = $egLiveTranslateIP . '/specials/SpecialLiveTranslate.php'; |
| 67 | + |
| 68 | +$wgSpecialPages['LiveTranslate'] = 'SpecialLiveTranslate'; |
| 69 | +$wgSpecialPageGroups['LiveTranslate'] = 'pagetools'; |
| 70 | + |
| 71 | +$wgAPIModules['importtms'] = 'ApiImportTranslationMemories'; |
| 72 | +$wgAPIModules['livetranslate'] = 'ApiLiveTranslate'; |
| 73 | +$wgAPIListModules['livetranslate'] = 'ApiQueryLiveTranslate'; |
| 74 | +$wgAPIListModules['translationmemories'] = 'ApiQueryTranslationMemories'; |
| 75 | + |
| 76 | +$wgHooks['ArticleViewHeader'][] = 'LiveTranslateHooks::onArticleViewHeader'; |
| 77 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'LiveTranslateHooks::onSchemaUpdate'; |
| 78 | +$wgHooks['ArticleSaveComplete'][] = 'LiveTranslateHooks::onArticleSaveComplete'; |
| 79 | +$wgHooks['LanguageGetMagic'][] = 'LiveTranslateHooks::addMagicWords'; |
| 80 | +$wgHooks['InternalParseBeforeLinks'][] = 'LiveTranslateHooks::stripMagicWords'; |
| 81 | +$wgHooks['OutputPageParserOutput'][] = 'LiveTranslateHooks::onOutputPageParserOutput'; |
| 82 | + |
| 83 | +$egLTJSMessages = array( |
| 84 | + 'livetranslate-button-translate', |
| 85 | + 'livetranslate-button-translating', |
| 86 | + 'livetranslate-dictionary-error', |
| 87 | + 'livetranslate-button-translate', |
| 88 | + 'livetranslate-button-revert', |
| 89 | + 'livetranslate-translate-to', |
| 90 | +); |
| 91 | + |
| 92 | +// For backward compatibility with MW < 1.17. |
| 93 | +if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) { |
| 94 | + $moduleTemplate = array( |
| 95 | + 'localBasePath' => dirname( __FILE__ ), |
| 96 | + 'remoteBasePath' => $egLiveTranslateScriptPath, |
| 97 | + 'group' => 'ext.livetranslate' |
| 98 | + ); |
| 99 | + |
| 100 | + $wgResourceModules['ext.livetranslate'] = $moduleTemplate + array( |
| 101 | + 'scripts' => array( |
| 102 | + 'includes/ext.livetranslate.js', |
| 103 | + 'includes/ext.lt.tm.js', |
| 104 | + 'includes/jquery.replaceText.js', |
| 105 | + 'includes/jquery.liveTranslate.js' |
| 106 | + ), |
| 107 | + 'dependencies' => array( 'jquery'/*, 'jquery.ui.button'*/ ), |
| 108 | + 'messages' => $egLTJSMessages |
| 109 | + ); |
| 110 | + |
| 111 | + $wgResourceModules['ext.lt.google'] = $moduleTemplate + array( |
| 112 | + 'scripts' => array( 'includes/ext.lt.google.js' ), |
| 113 | + 'dependencies' => array( 'ext.livetranslate' ), |
| 114 | + 'messages' => array() |
| 115 | + ); |
| 116 | + |
| 117 | + $wgResourceModules['ext.lt.ms'] = $moduleTemplate + array( |
| 118 | + 'scripts' => array( 'includes/ext.lt.ms.js' ), |
| 119 | + 'dependencies' => array( 'ext.livetranslate' ), |
| 120 | + 'messages' => array() |
| 121 | + ); |
| 122 | +} |
| 123 | + |
| 124 | +/** |
| 125 | + * Enum for translation memory types. |
| 126 | + * |
| 127 | + * @since 0.4 |
| 128 | + */ |
| 129 | +define( 'TMT_LTF', 0 ); |
| 130 | +define( 'TMT_TMX', 1 ); |
| 131 | +define( 'TMT_GCSV', 2 ); |
| 132 | + |
| 133 | +/** |
| 134 | + * Enum for translation services. |
| 135 | + * |
| 136 | + * @since 1.1 |
| 137 | + */ |
| 138 | +define( 'LTS_GOOGLE', 0 ); |
| 139 | +define( 'LTS_MS', 1 ); |
| 140 | + |
| 141 | +$egLiveTranslateMagicWords = array(); |
| 142 | + |
| 143 | +require_once 'LiveTranslate_Settings.php'; |
| 144 | + |
| 145 | +$wgAvailableRights[] = 'managetms'; |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 146 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate_Settings.php |
— | — | @@ -0,0 +1,73 @@ |
| 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 | +$wgGroupPermissions['tmxadmin']['managetms'] = true; |
| 30 | + |
| 31 | +# Default translation memory type. |
| 32 | +# TMT_LTF, TMT_TMX, TMT_GCSV |
| 33 | +$egLiveTranslateTMT = TMT_LTF; |
| 34 | + |
| 35 | +# Translation service to use. |
| 36 | +# LTS_GOOGLE, LTS_MS |
| 37 | +$egLiveTranslateService = LTS_GOOGLE; |
| 38 | + |
| 39 | +# The namespaces that should show the translation control. |
| 40 | +$egLTNSWithTranslationControl = array( |
| 41 | + NS_MAIN => true, |
| 42 | + NS_TALK => false, |
| 43 | + NS_USER => true, |
| 44 | + NS_USER_TALK => false, |
| 45 | + NS_PROJECT => true, |
| 46 | + NS_PROJECT_TALK => false, |
| 47 | + NS_IMAGE => true, |
| 48 | + NS_IMAGE_TALK => false, |
| 49 | + NS_MEDIAWIKI => false, |
| 50 | + NS_MEDIAWIKI_TALK => false, |
| 51 | + NS_TEMPLATE => false, |
| 52 | + NS_TEMPLATE_TALK => false, |
| 53 | + NS_HELP => true, |
| 54 | + NS_HELP_TALK => false, |
| 55 | + NS_CATEGORY => true, |
| 56 | + NS_CATEGORY_TALK => false, |
| 57 | +); |
| 58 | + |
| 59 | +# Show the control for namespaces not specified in $egLTNSWithTranslationControl? |
| 60 | +$egLTUnknownNSShowControl = true; |
| 61 | + |
| 62 | +# When true, this prevents storange of translations that are the same in the source and target language. |
| 63 | +$egLTRequireSignificance = false; |
| 64 | + |
| 65 | +# When true, debugging messages will be logged using console.log(). Do not use on production wikis. |
| 66 | +$egLiveTranslateDebugJS = false; |
| 67 | + |
| 68 | +# Google API key, needed when using the Google Translation service. |
| 69 | +# https://code.google.com/apis/console |
| 70 | +$egGoogleApiKey = ''; |
| 71 | + |
| 72 | +# Microsoft App Id, needed when using the Microsoft Translation service. |
| 73 | +# http://www.bing.com/developers/createapp.aspx |
| 74 | +$egLiveTranslateMSAppId = ''; |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate_Settings.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 75 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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->getName() ) ); |
| 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_2_1/specials/SpecialLiveTranslate.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 369 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate.hooks.php |
— | — | @@ -0,0 +1,352 @@ |
| 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 | + $egLiveTranslateLanguages = array_unique( $egLiveTranslateLanguages ); |
| 30 | + |
| 31 | + $title = $article->getTitle(); |
| 32 | + |
| 33 | + $currentLang = LiveTranslateFunctions::getCurrentLang( $title ); |
| 34 | + |
| 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 | + $langs = array(); |
| 159 | + |
| 160 | + foreach ( LiveTranslateFunctions::getLanguages( $currentLang ) as $label => $code ) { |
| 161 | + $langs[] = "$code|$label"; |
| 162 | + } |
| 163 | + |
| 164 | + $wgOut->addHTML( |
| 165 | + Html::rawElement( |
| 166 | + 'div', |
| 167 | + array( |
| 168 | + 'id' => 'livetranslatediv', |
| 169 | + 'sourcelang' => $currentLang, |
| 170 | + 'languages' => implode( '||', $langs ) |
| 171 | + ) |
| 172 | + ) |
| 173 | + ); |
| 174 | + |
| 175 | + LiveTranslateFunctions::loadJs(); |
| 176 | + } |
| 177 | + |
| 178 | + /** |
| 179 | + * Schema update to set up the needed database tables. |
| 180 | + * |
| 181 | + * @since 0.1 |
| 182 | + * |
| 183 | + * @param DatabaseUpdater $updater |
| 184 | + * |
| 185 | + * @return true |
| 186 | + */ |
| 187 | + public static function onSchemaUpdate( /* DatabaseUpdater */ $updater = null ) { |
| 188 | + global $wgDBtype, $egLiveTranslateIP; |
| 189 | + |
| 190 | + if ( $wgDBtype == 'mysql' ) { |
| 191 | + // Set up the current schema. |
| 192 | + if ( $updater === null ) { |
| 193 | + global $wgExtNewTables, $wgExtNewIndexes, $wgExtNewFields; |
| 194 | + |
| 195 | + $wgExtNewTables[] = array( |
| 196 | + 'live_translate', |
| 197 | + $egLiveTranslateIP . '/LiveTranslate.sql', |
| 198 | + true |
| 199 | + ); |
| 200 | + $wgExtNewTables[] = array( |
| 201 | + 'live_translate_memories', |
| 202 | + $egLiveTranslateIP . '/LiveTranslate.sql', |
| 203 | + true |
| 204 | + ); |
| 205 | + |
| 206 | + $wgExtNewIndexes[] = array( |
| 207 | + 'live_translate', |
| 208 | + 'word_translation', |
| 209 | + $egLiveTranslateIP . '/sql/LT_IndexWordTranslation.sql', |
| 210 | + true |
| 211 | + ); |
| 212 | + |
| 213 | + $wgExtNewFields[] = array( |
| 214 | + 'live_translate', |
| 215 | + 'memory_id', |
| 216 | + $egLiveTranslateIP . '/sql/LT_addTMField.sql' |
| 217 | + ); |
| 218 | + |
| 219 | + $wgExtNewFields[] = array( |
| 220 | + 'live_translate_memories', |
| 221 | + 'memory_version_hash', |
| 222 | + $egLiveTranslateIP . '/sql/LT_addTMHashField.sql' |
| 223 | + ); |
| 224 | + } |
| 225 | + else { |
| 226 | + $updater->addExtensionUpdate( array( |
| 227 | + 'addTable', |
| 228 | + 'live_translate', |
| 229 | + $egLiveTranslateIP . '/LiveTranslate.sql', |
| 230 | + true |
| 231 | + ) ); |
| 232 | + $updater->addExtensionUpdate( array( |
| 233 | + 'addTable', |
| 234 | + 'live_translate_memories', |
| 235 | + $egLiveTranslateIP . '/LiveTranslate.sql', |
| 236 | + true |
| 237 | + ) ); |
| 238 | + |
| 239 | + $updater->addExtensionUpdate( array( |
| 240 | + 'addIndex', |
| 241 | + 'live_translate', |
| 242 | + 'word_translation', |
| 243 | + $egLiveTranslateIP . '/sql/LT_IndexWordTranslation.sql', |
| 244 | + true |
| 245 | + ) ); |
| 246 | + |
| 247 | + $updater->addExtensionUpdate( array( |
| 248 | + 'addField', |
| 249 | + 'live_translate', |
| 250 | + 'memory_id', |
| 251 | + $egLiveTranslateIP . '/sql/LT_addTMField.sql', |
| 252 | + true |
| 253 | + ) ); |
| 254 | + |
| 255 | + $updater->addExtensionUpdate( array( |
| 256 | + 'addField', |
| 257 | + 'live_translate_memories', |
| 258 | + 'memory_version_hash', |
| 259 | + $egLiveTranslateIP . '/sql/LT_addTMHashField.sql', |
| 260 | + true |
| 261 | + ) ); |
| 262 | + } |
| 263 | + } |
| 264 | + |
| 265 | + return true; |
| 266 | + } |
| 267 | + |
| 268 | + /** |
| 269 | + * Handles edits to the dictionary page to save the translations into the db. |
| 270 | + * |
| 271 | + * @since 0.1 |
| 272 | + * |
| 273 | + * @return true |
| 274 | + */ |
| 275 | + public static function onArticleSaveComplete( &$article, &$user, $text, $summary, |
| 276 | + $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect = null ) { |
| 277 | + |
| 278 | + $title = $article->getTitle(); |
| 279 | + |
| 280 | + // FIXME: Hitting the db on every page save should be avoided |
| 281 | + if ( in_array( $title->getFullText(), LiveTranslateFunctions::getLocalMemoryNames() ) ) { |
| 282 | + $requestData = array( |
| 283 | + 'action' => 'importtms', |
| 284 | + 'format' => 'json', |
| 285 | + 'source' => $title->getFullText(), |
| 286 | + 'type' => LiveTranslateFunctions::getMemoryType( $title->getFullText() ), |
| 287 | + 'local' => 1 |
| 288 | + ); |
| 289 | + |
| 290 | + $api = new ApiMain( new FauxRequest( $requestData, true ), true ); |
| 291 | + $api->execute(); |
| 292 | + $response = $api->getResultData(); |
| 293 | + } |
| 294 | + |
| 295 | + return true; |
| 296 | + } |
| 297 | + |
| 298 | + /** |
| 299 | + * Registers the magic words to show and hide the translation control. |
| 300 | + * |
| 301 | + * TODO: apparently there is some new way of doing this for quite a while, |
| 302 | + * which is not linked in the docs. If someone cares to explain the new stuff, |
| 303 | + * I'll be happy to update this. |
| 304 | + * |
| 305 | + * @since 0.6 |
| 306 | + * |
| 307 | + * @param array &$magicWords |
| 308 | + * @param string $langCode |
| 309 | + * |
| 310 | + * @return true |
| 311 | + */ |
| 312 | + public static function addMagicWords( array &$magicWords, $langCode ) { |
| 313 | + $magicWords['LT_NOTRANSLATIONCONTROL'] = array( 0, '__NOTRANSLATIONCONTROL__' ); |
| 314 | + $magicWords['LT_SHOWTRANSLATIONCONTROL'] =array( 0, '__SHOWTRANSLATIONCONTROL__' ); |
| 315 | + |
| 316 | + return true; |
| 317 | + } |
| 318 | + |
| 319 | + /** |
| 320 | + * Strips the magic words added by Live Translate from the page text. |
| 321 | + * |
| 322 | + * @since 0.6 |
| 323 | + * |
| 324 | + * @param Parser &$parser |
| 325 | + * @param string &$text |
| 326 | + * |
| 327 | + * @return true |
| 328 | + */ |
| 329 | + public static function stripMagicWords( Parser &$parser, &$text ) { |
| 330 | + global $egLiveTranslateMagicWords; |
| 331 | + |
| 332 | + $mw = MagicWord::get( 'LT_NOTRANSLATIONCONTROL' ); |
| 333 | + if ( $mw->matchAndRemove( $text ) ) { |
| 334 | + $egLiveTranslateMagicWords[] = 'LT_NOTRANSLATIONCONTROL'; |
| 335 | + } |
| 336 | + |
| 337 | + $mw = MagicWord::get( 'LT_SHOWTRANSLATIONCONTROL' ); |
| 338 | + if ( $mw->matchAndRemove( $text ) ) { |
| 339 | + $egLiveTranslateMagicWords[] = 'LT_SHOWTRANSLATIONCONTROL'; |
| 340 | + } |
| 341 | + |
| 342 | + $po = $parser->getOutput(); |
| 343 | + $po->mLTMagicWords = $egLiveTranslateMagicWords; |
| 344 | + |
| 345 | + return true; |
| 346 | + } |
| 347 | + |
| 348 | + public static function onOutputPageParserOutput( $outputpage, $parseroutput ) { |
| 349 | + $magicWords = isset( $parseroutput->mLTMagicWords ) ? $parseroutput->mLTMagicWords : array(); |
| 350 | + return true; |
| 351 | + } |
| 352 | + |
| 353 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 354 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/INSTALL |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 71 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/RELEASE-NOTES |
— | — | @@ -0,0 +1,91 @@ |
| 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.2.1 === |
| 9 | +2011-09-12 |
| 10 | + |
| 11 | +* Fixed Internet Explorer compatibility issue. |
| 12 | + |
| 13 | +=== Version 1.2 === |
| 14 | +2011-08-14 |
| 15 | + |
| 16 | +* Rewrote translation control JavaScript to a jQuery plugin. |
| 17 | +* Added caching layer utilizing memory and LocalStorage when available to speed up local translations. |
| 18 | +* Added API module to query translation memories. |
| 19 | +* Added i18n alias file. |
| 20 | +* Added TMX admin user rights group. |
| 21 | + |
| 22 | +=== Version 1.1.1 === |
| 23 | +2011-06-22 |
| 24 | + |
| 25 | +* Fixed Internet Explorer compatibility issue. |
| 26 | +* Fixed bug in Microsoft transltion script for MW < 1.17. |
| 27 | +* Made Microsoft transltion script more robust by adding timeouts. |
| 28 | + |
| 29 | +=== Version 1.1 === |
| 30 | +2011-06-16 |
| 31 | + |
| 32 | +* Added support for the Microsoft Translation service. |
| 33 | +* Added support for comments in the LiveTranslate TMX format. |
| 34 | +* Added debug messages in the JavaScript that can be logged by setting $egLiveTranslateDebugJS to true. |
| 35 | + |
| 36 | +=== Version 1.0.1 === |
| 37 | +2011-05-27 |
| 38 | + |
| 39 | +* Added option (on by default) to store insignificant translations. |
| 40 | +* Tweaked the LTF parser to allow specifying a word that should never be translated. |
| 41 | + |
| 42 | +=== Version 1.0 === |
| 43 | +2011-05-26 |
| 44 | + |
| 45 | +* Fixed bug in the API. |
| 46 | +* Fixed some JavaScript issues causing problems for IE users. |
| 47 | +* Added missing right declaration. |
| 48 | + |
| 49 | +=== Version 0.6 === |
| 50 | +2011-04-21 |
| 51 | + |
| 52 | +* Added settings to specify per-namespace if the translation control should be shown or not. |
| 53 | +* Use of FormatJson::encode instead of json_encode for compatibility with PHP5 < 5.2. |
| 54 | + |
| 55 | +=== Version 0.5 === |
| 56 | +2011-01-16 |
| 57 | + |
| 58 | +* Modified the LT API to work with batches, so translation doesn't break for big translation memories. |
| 59 | +* Fixed regex escaping issue that caused translations to stop when encountering certain characters in special words. |
| 60 | + |
| 61 | +=== Version 0.4 === |
| 62 | +2011-01-14 |
| 63 | + |
| 64 | +* Added support for multiple translation memories. |
| 65 | +* Added Special:LiveTranslate to manage the translation memories that should be used. |
| 66 | +* Added support for remote translation memories. |
| 67 | +* Added support for the Translation Memory eXchange (TMX) format. |
| 68 | +* Added Google branding, which is required when using the Google Translate API. |
| 69 | +: https://code.google.com/apis/language/translate/v1/getting_started.html#getBranding |
| 70 | +* Improved translation memory insertion into the database. |
| 71 | +* Added better tracking of translation memory sizes and language counts. |
| 72 | + |
| 73 | +=== Version 0.3 === |
| 74 | +2011-01-07 |
| 75 | + |
| 76 | +* Added (partial) compatibility with IE8. Random errors still occur. Use a modern browser to prevent this. |
| 77 | +* Fixed issue with trim-prevention, causing |-signs to semi-randomly get inserted into translated text. |
| 78 | +* Only show the translation control when an API key is provided. |
| 79 | + |
| 80 | +=== Version 0.2 === |
| 81 | +2010-12-24 |
| 82 | + |
| 83 | +* Fixed installation compatibility issue with MW 1.16. |
| 84 | +* Fixed display of translation control to only happen on existing pages. |
| 85 | +* Fixed issues with inserting notranslatre tags into the page source. |
| 86 | + |
| 87 | +=== Version 0.1 === |
| 88 | +2010-12-22 |
| 89 | + |
| 90 | +* Added simple translation interface to the right top of articles. |
| 91 | +* Implemented translation via the Google Translate API. |
| 92 | +* Added dictionary for special words with synonyms support. |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/RELEASE-NOTES |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 93 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/includes/LT_TMParser.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 64 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/includes/LT_GCSVParser.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 26 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/includes/ext.lt.google.js |
— | — | @@ -0,0 +1,179 @@ |
| 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( $, lt ){ window.translationService = function() { |
| 14 | + |
| 15 | + var self = this; |
| 16 | + |
| 17 | + this.done = function(){}; |
| 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 | + lt.debug( '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(); |
| 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 | + lt.debug( '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(); |
| 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 | + lt.debug( 'Google: Translating element' ); |
| 130 | + this.runningJobs++; |
| 131 | + |
| 132 | + var maxChunkLength = 500; |
| 133 | + |
| 134 | + element.contents().each( function() { |
| 135 | + lt.debug( '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 | + lt.debug( '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 | + lt.debug( 'Google: Found child node' ); |
| 158 | + self.translateElement( $( this ), sourceLang, targetLang ); |
| 159 | + } |
| 160 | + else { |
| 161 | + lt.debug( 'Google: Found ignore node' ); |
| 162 | + } |
| 163 | + } ); |
| 164 | + |
| 165 | + this.handleTranslationCompletion(); |
| 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 | + this.handleTranslationCompletion = function() { |
| 174 | + if ( !--this.runningJobs ) { |
| 175 | + lt.debug( 'Google: translation process done' ); |
| 176 | + this.done(); |
| 177 | + } |
| 178 | + } |
| 179 | + |
| 180 | +}; })( jQuery, window.liveTranslate ); |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/includes/ext.lt.google.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 181 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/includes/LT_TMUnit.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 145 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/includes/jquery.liveTranslate.js |
— | — | @@ -0,0 +1,244 @@ |
| 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 ( $, lt ) { $.fn.liveTranslate = function( options ) { |
| 11 | + |
| 12 | + var _this = this; |
| 13 | + |
| 14 | + /** |
| 15 | + * Start both the local and remote components of the translation process. |
| 16 | + * |
| 17 | + * @since 1.2 |
| 18 | + */ |
| 19 | + this.doTranslations = function() { |
| 20 | + _this.runningJobs = 2; |
| 21 | + |
| 22 | + _this.doLocalTranslation( _this.completeTranslationProcess ); |
| 23 | + _this.doRemoteTranslation( _this.completeTranslationProcess ); |
| 24 | + }; |
| 25 | + |
| 26 | + /** |
| 27 | + * Finds and returns the special words in the page by looking |
| 28 | + * for spans with notranslate class. This obviously only works |
| 29 | + * after these tags have been inserted with insertSpecialWords. |
| 30 | + * |
| 31 | + * @since 1.2 |
| 32 | + * |
| 33 | + * @return Array |
| 34 | + */ |
| 35 | + this.findSpecialWords = function() { |
| 36 | + var words = []; |
| 37 | + |
| 38 | + $.each( $( "span.notranslate" ), function( i, v ) { |
| 39 | + words.push( $.trim( $( v ).text() ) ); |
| 40 | + } ); |
| 41 | + |
| 42 | + return words; |
| 43 | + }; |
| 44 | + |
| 45 | + /** |
| 46 | + * Does the local transltaions by obtaining the |
| 47 | + * translations for the special words and replacing |
| 48 | + * them where a translation is available. |
| 49 | + * |
| 50 | + * @since 1.2 |
| 51 | + * |
| 52 | + * @param {Function} callback |
| 53 | + */ |
| 54 | + this.doLocalTranslation = function( callback ) { |
| 55 | + _this.memory.getTranslations( |
| 56 | + { |
| 57 | + source: _this.currentLang, |
| 58 | + target: _this.select.val(), |
| 59 | + words: _this.findSpecialWords() |
| 60 | + }, |
| 61 | + function( translations ) { |
| 62 | + $.each( $( "span.notranslate" ), function( i, v ) { |
| 63 | + var currentText = $(v).text(); |
| 64 | + var trimmedText = $.trim( currentText ); |
| 65 | + |
| 66 | + if ( translations[trimmedText] ) { |
| 67 | + $( v ).text( currentText.replace( trimmedText, translations[trimmedText] ) ); |
| 68 | + } |
| 69 | + }); |
| 70 | + |
| 71 | + callback(); |
| 72 | + } |
| 73 | + ); |
| 74 | + }; |
| 75 | + |
| 76 | + /** |
| 77 | + * Does the remote translation, ie everything not in notranslate spans. |
| 78 | + * |
| 79 | + * @since 1.2 |
| 80 | + * |
| 81 | + * @param {Function} callback |
| 82 | + */ |
| 83 | + this.doRemoteTranslation = function( callback ) { |
| 84 | + var translator = new window.translationService(); |
| 85 | + translator.done = callback; |
| 86 | + lt.debug( 'Initiating remote translation' ); |
| 87 | + translator.translateElement( $( '#bodyContent' ), _this.currentLang, _this.select.val() ); |
| 88 | + }; |
| 89 | + |
| 90 | + /** |
| 91 | + * Function to be called once a transslation job has finished. |
| 92 | + * Once there are no more running jobs, the state of the translation |
| 93 | + * control is updated to translation completion. |
| 94 | + * |
| 95 | + * @since 1.2 |
| 96 | + */ |
| 97 | + this.completeTranslationProcess = function() { |
| 98 | + if ( !--_this.runningJobs ) { |
| 99 | + _this.translateButton.attr( "disabled", false ).text( lt.msg( 'livetranslate-button-translate' ) ); |
| 100 | + _this.select.attr( "disabled", false ); |
| 101 | + _this.revertButton.css( 'display', 'inline' ); |
| 102 | + } |
| 103 | + }; |
| 104 | + |
| 105 | + /** |
| 106 | + * Inserts notranslate spans around the words specified in the passed array in the page content. |
| 107 | + * |
| 108 | + * @since 1.2 |
| 109 | + * |
| 110 | + * @param {Array} words |
| 111 | + */ |
| 112 | + this.insertSpecialWords = function( words ) { |
| 113 | + lt.debug( 'inserting special words' ); |
| 114 | + |
| 115 | + for ( i in words ) { |
| 116 | + $( '#bodyContent *' ).replaceText( |
| 117 | + new RegExp( "(\\W)*" + RegExp.escape( words[i] ) + "(\\W)*", "g" ), |
| 118 | + function( str ) { |
| 119 | + return '<span class="notranslate">' + str + '</span>'; |
| 120 | + } |
| 121 | + ); |
| 122 | + } |
| 123 | + }; |
| 124 | + |
| 125 | + /** |
| 126 | + * Obtain the special words and wrap occurances of them into notranslate spans. |
| 127 | + * |
| 128 | + * @since 1.2 |
| 129 | + * |
| 130 | + * @param {Function} callback |
| 131 | + */ |
| 132 | + this.obatinAndInsetSpecialWords = function( callback ) { |
| 133 | + // TODO: only run at first translation |
| 134 | + _this.memory.getSpecialWords( _this.currentLang, function( specialWords ) { |
| 135 | + _this.specialWords = specialWords; |
| 136 | + _this.insertSpecialWords( specialWords ); |
| 137 | + |
| 138 | + callback(); |
| 139 | + } ); |
| 140 | + }; |
| 141 | + |
| 142 | + /** |
| 143 | + * Setup the translation control. |
| 144 | + * Should be called on construction. |
| 145 | + * |
| 146 | + * @since 1.2 |
| 147 | + */ |
| 148 | + this.setup = function() { |
| 149 | + var defaults = { |
| 150 | + languages: {}, |
| 151 | + sourcelang: 'en' |
| 152 | + }; |
| 153 | + |
| 154 | + $.extend( options, defaults ); |
| 155 | + |
| 156 | + $.each( this.attr( 'languages' ).split( '||' ), function( i, lang ) { |
| 157 | + var parts = lang.split( '|' ); |
| 158 | + options.languages[parts[0]] = parts[1]; |
| 159 | + } ); |
| 160 | + |
| 161 | + _this.currentLang = this.attr( 'sourcelang' ); |
| 162 | + |
| 163 | + // For the "show original" feature. |
| 164 | + _this.originalHtml = false; |
| 165 | + |
| 166 | + _this.textAreaElement = document.createElement( 'textarea' ); |
| 167 | + |
| 168 | + _this.uniqueId = Math.random().toString().substring( 2 ); |
| 169 | + |
| 170 | + _this.memory = lt.memory.singleton(); |
| 171 | + |
| 172 | + _this.runningJobs = 0; |
| 173 | + |
| 174 | + _this.buildHtml(); |
| 175 | + |
| 176 | + _this.bindEvents(); |
| 177 | + }; |
| 178 | + |
| 179 | + /** |
| 180 | + * Build up the HTML for the translation control and add it to the DOM element. |
| 181 | + * |
| 182 | + * @since 1.2 |
| 183 | + */ |
| 184 | + this.buildHtml = function() { |
| 185 | + _this.attr( { |
| 186 | + style: 'display:inline; float:right' |
| 187 | + } ).attr( 'class', 'notranslate' ); |
| 188 | + |
| 189 | + _this.html( lt.msg( 'livetranslate-translate-to' ) ); |
| 190 | + |
| 191 | + _this.select = $( '<select />' ).attr( { |
| 192 | + id: 'ltselect' + _this.uniqueId |
| 193 | + } ); |
| 194 | + |
| 195 | + for ( langCode in options.languages ) { |
| 196 | + _this.select.append( $( '<option />' ).attr( 'value', langCode ).text( options.languages[langCode] ) ); |
| 197 | + } |
| 198 | + |
| 199 | + _this.translateButton = $( '<button />' ).attr( { |
| 200 | + id: 'livetranslatebutton' + _this.uniqueId |
| 201 | + } ).text( lt.msg( 'livetranslate-button-translate' ) ); // .button() |
| 202 | + |
| 203 | + _this.revertButton = $( '<button />' ).attr( { |
| 204 | + id: 'ltrevertbutton' + _this.uniqueId, |
| 205 | + style: 'display:none' |
| 206 | + } ).text( lt.msg( 'livetranslate-button-revert' ) ); // .button() |
| 207 | + |
| 208 | + _this.append( _this.select, _this.translateButton, _this.revertButton ); |
| 209 | + }; |
| 210 | + |
| 211 | + /** |
| 212 | + * Bind the event handlers to the components of the transltaion control. |
| 213 | + * |
| 214 | + * @since 1.2 |
| 215 | + */ |
| 216 | + this.bindEvents = function() { |
| 217 | + _this.translateButton.click( function() { |
| 218 | + _this.originalHtml = $( '#bodyContent' ).html(); |
| 219 | + |
| 220 | + $( this ).attr( "disabled", true ).text( lt.msg( 'livetranslate-button-translating' ) ); |
| 221 | + _this.select.attr( "disabled", true ); |
| 222 | + |
| 223 | + _this.obatinAndInsetSpecialWords( _this.doTranslations ); |
| 224 | + } ); |
| 225 | + |
| 226 | + _this.revertButton.click( function() { |
| 227 | + // Replace the body content wth it's original value. |
| 228 | + // This un-binds the jQuery selectors and event handlers. |
| 229 | + $( '#bodyContent' ).html( _this.originalHtml ); |
| 230 | + |
| 231 | + // Re-assing the controls. |
| 232 | + _this.select = $( '#ltselect' + _this.uniqueId ); |
| 233 | + _this.translateButton = $( '#livetranslatebutton' + _this.uniqueId ); |
| 234 | + _this.revertButton = $( '#ltrevertbutton' + _this.uniqueId ); |
| 235 | + |
| 236 | + // Re-bind the events to the controls. |
| 237 | + _this.bindEvents(); |
| 238 | + } ) |
| 239 | + }; |
| 240 | + |
| 241 | + this.setup(); |
| 242 | + |
| 243 | + return this; |
| 244 | + |
| 245 | +}; } )( jQuery, window.liveTranslate ); |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/includes/jquery.liveTranslate.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 246 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/includes/LT_LTFParser.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 70 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/includes/ext.livetranslate.js |
— | — | @@ -0,0 +1,43 @@ |
| 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 | +window.liveTranslate = new( function() { |
| 11 | + |
| 12 | + this.debug = function( message ) { |
| 13 | + if ( window.ltDebugMessages ) { |
| 14 | + if ( typeof console === 'undefined' ) { |
| 15 | + document.title = 'Live Translate: ' + message; |
| 16 | + } |
| 17 | + else { |
| 18 | + console.log( 'Live Translate: ' + message ); |
| 19 | + } |
| 20 | + } |
| 21 | + } |
| 22 | + |
| 23 | + this.msg = function() { |
| 24 | + if ( typeof mediaWiki === 'undefined' ) { |
| 25 | + message = window.wgLTEMessages[arguments[0]]; |
| 26 | + |
| 27 | + for ( var i = arguments.length - 1; i > 0; i-- ) { |
| 28 | + message = message.replace( '$' + i, arguments[i] ); |
| 29 | + } |
| 30 | + |
| 31 | + return message; |
| 32 | + } |
| 33 | + else { |
| 34 | + return mediaWiki.msg.apply( this, arguments ); |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | +} )(); |
| 39 | + |
| 40 | +(function( $ ) { $( document ).ready( function() { |
| 41 | + |
| 42 | + $( '#livetranslatediv' ).liveTranslate( {} ); |
| 43 | + |
| 44 | +} ); })( jQuery ); |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/includes/ext.livetranslate.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 45 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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( $, lt ){ window.translationService = function() { |
| 11 | + |
| 12 | + var self = this; |
| 13 | + |
| 14 | + this.done = function(){}; |
| 15 | + |
| 16 | + this.runningJobs = 0; |
| 17 | + this.checkingForIdle = false; |
| 18 | + this.lastCompletion; |
| 19 | + |
| 20 | + // This is to enable a hack to decode quotes. |
| 21 | + this.textAreaElement = document.createElement( 'textarea' ); |
| 22 | + |
| 23 | + /** |
| 24 | + * Determines a chunk to translate of an DOM elements contents and calls the Microsoft Translate API. |
| 25 | + * Then calls itself if there is any remaining work to be done. |
| 26 | + * |
| 27 | + * @param {array} untranslatedsentences |
| 28 | + * @param {array} chunks |
| 29 | + * @param {integer} currentMaxSize |
| 30 | + * @param {string} sourceLang |
| 31 | + * @param {string} targetLang |
| 32 | + * @param {DOM element} element |
| 33 | + */ |
| 34 | + this.translateChunk = function( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ) { |
| 35 | + lt.debug( 'MS: Translating chunk' ); |
| 36 | + var remainingPart = false; |
| 37 | + var partToUse = false; |
| 38 | + var sentenceCount = 0; |
| 39 | + var currentLength = 0; |
| 40 | + |
| 41 | + // Find the scentances that can be put in the current chunk. |
| 42 | + for ( i in untranslatedsentences ) { |
| 43 | + sentenceCount++; |
| 44 | + |
| 45 | + if ( currentLength + untranslatedsentences[i].length < currentMaxSize ) { |
| 46 | + currentLength += untranslatedsentences[i].length; |
| 47 | + } |
| 48 | + else if ( untranslatedsentences[i].length > 0 ) { |
| 49 | + if ( currentLength == 0 ) { |
| 50 | + // If the first scentance is longer then the max chunk legth, split it. |
| 51 | + partToUse = untranslatedsentences[i].substr( 0, currentMaxSize - currentLength ); |
| 52 | + remainingPart = untranslatedsentences[i].substr( currentMaxSize - currentLength ); |
| 53 | + } |
| 54 | + |
| 55 | + break; |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + var chunk = ''; |
| 60 | + |
| 61 | + // Build the chunck. |
| 62 | + for ( i = 0; i < sentenceCount; i++ ) { |
| 63 | + var part = untranslatedsentences.shift(); |
| 64 | + |
| 65 | + if ( i != sentenceCount - 1 || partToUse === false ) { |
| 66 | + chunk += part; |
| 67 | + } |
| 68 | + } |
| 69 | + |
| 70 | + // If there is a remaining part, re-add it to the scentances to translate list. |
| 71 | + if ( remainingPart !== false ) { |
| 72 | + untranslatedsentences.unshift( remainingPart ); |
| 73 | + } |
| 74 | + |
| 75 | + // If there is a partial scentance, add it to the chunk. |
| 76 | + if ( partToUse !== false ) { |
| 77 | + chunk += partToUse; |
| 78 | + } |
| 79 | + |
| 80 | + // If the lenght is 0, the element has been translated. |
| 81 | + if ( chunk.length == 0 ) { |
| 82 | + this.handleTranslationCompletion(); |
| 83 | + return; |
| 84 | + } |
| 85 | + |
| 86 | + // Keep track of leading and tailing spaces, as they often get modified by the GT API. |
| 87 | + var leadingSpace = chunk.substr( 0, 1 ) == ' ' ? ' ' : ''; |
| 88 | + var tailingSpace = ( chunk.length > 1 && chunk.substr( chunk.length - 1, 1 ) == ' ' ) ? ' ' : ''; |
| 89 | + |
| 90 | + var chunckTranslationDone = function( translation ) { |
| 91 | + lt.debug( 'MS: Translated chunk' ); |
| 92 | + |
| 93 | + if ( translation ) { |
| 94 | + chunks.push( leadingSpace + translation + tailingSpace ); |
| 95 | + } |
| 96 | + else { |
| 97 | + // If the translation failed, keep the original text. |
| 98 | + chunks.push( chunk ); |
| 99 | + } |
| 100 | + |
| 101 | + if ( untranslatedsentences.length == 0 ) { |
| 102 | + // If the current chunk was smaller then the max size, node translation is complete, so update text. |
| 103 | + self.textAreaElement.innerHTML = chunks.join( '' ); // This is a hack to decode quotes. |
| 104 | + element.replaceData( 0, element.length, self.textAreaElement.value ); |
| 105 | + |
| 106 | + lt.debug( 'MS: Translated element' ); |
| 107 | + self.handleTranslationCompletion(); |
| 108 | + } |
| 109 | + else { |
| 110 | + // If there is more work to do, move on to the next chunk. |
| 111 | + self.translateChunk( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ); |
| 112 | + } |
| 113 | + }; |
| 114 | + |
| 115 | + $.getJSON( |
| 116 | + 'http://api.microsofttranslator.com/V2/Ajax.svc/Translate?oncomplete=?', |
| 117 | + { |
| 118 | + 'appId': window.ltMsAppId, |
| 119 | + 'from': sourceLang, |
| 120 | + 'to': targetLang, |
| 121 | + 'text': $.trim( chunk ) // Trim, so the result does not contain preceding or tailing spaces. |
| 122 | + }, |
| 123 | + chunckTranslationDone |
| 124 | + ); |
| 125 | + } |
| 126 | + |
| 127 | + /** |
| 128 | + * Translates a single DOM element using Microsoft Translate. |
| 129 | + * Loops through child elements and recursively calls itself to translate these. |
| 130 | + * |
| 131 | + * @param {jQuery} element |
| 132 | + * @param {string} sourceLang |
| 133 | + * @param {string} targetLang |
| 134 | + */ |
| 135 | + this.translateElement = function( element, sourceLang, targetLang ) { |
| 136 | + lt.debug( 'MS: Translating element' ); |
| 137 | + this.runningJobs++; |
| 138 | + |
| 139 | + var maxChunkLength = 500; |
| 140 | + |
| 141 | + element.contents().each( function() { |
| 142 | + lt.debug( 'MS: Element conent item' ); |
| 143 | + |
| 144 | + // If it's a text node, then translate it. |
| 145 | + if ( this.nodeType == 3 && typeof this.data === 'string' && $.trim( this.data ).length > 0 ) { |
| 146 | + lt.debug( 'MS: Found content node' ); |
| 147 | + |
| 148 | + self.runningJobs++; |
| 149 | + |
| 150 | +// if ( window.fooz < 7 ) { |
| 151 | +// window.fooz++; |
| 152 | +// if ( window.fooz > 6 ) { |
| 153 | +// alert( this.data + "\n---------------" ); |
| 154 | +// var partz = this.data.split( new RegExp( "[.!?](?=\\s+|$)", "gi" ) ); |
| 155 | +// for ( i in partz ) { |
| 156 | +// alert( partz[i] ); |
| 157 | +// } |
| 158 | +// } |
| 159 | +// } |
| 160 | + |
| 161 | + self.translateChunk( |
| 162 | + this.data.split( new RegExp( "([.!?])(?=\\s+|$)", "gi" ) ), // "(\\S.+?[.!?])(?=\\s+|$)" |
| 163 | + [], |
| 164 | + maxChunkLength, |
| 165 | + sourceLang, |
| 166 | + targetLang, |
| 167 | + this |
| 168 | + ); |
| 169 | + } |
| 170 | + // If it's an html element, check to see if it should be ignored, and if not, apply function again. |
| 171 | + else if ( this.nodeType != 3 |
| 172 | + && $.inArray( $( this ).attr( 'id' ), [ 'siteSub', 'jump-to-nav' ] ) == -1 |
| 173 | + && !$( this ).hasClass( 'notranslate' ) && !$( this ).hasClass( 'printfooter' ) |
| 174 | + && $( this ).text().length > 0 ) { |
| 175 | + |
| 176 | + lt.debug( 'MS: Found child node' ); |
| 177 | + self.translateElement( $( this ), sourceLang, targetLang ); |
| 178 | + } |
| 179 | + else { |
| 180 | + lt.debug( 'MS: Found ignore node' ); |
| 181 | + } |
| 182 | + } ); |
| 183 | + |
| 184 | + this.handleTranslationCompletion(); |
| 185 | + } |
| 186 | + |
| 187 | + this.invokeDone = function() { |
| 188 | + lt.debug( 'MS: translation process done' ); |
| 189 | + lt.debug( this.runningJobs ); |
| 190 | + this.runningJobs = 0; |
| 191 | + this.done(); |
| 192 | + } |
| 193 | + |
| 194 | + this.checkForIdleness = function( hits ) { |
| 195 | + lt.debug( 'MS: checkForIdleness' ); |
| 196 | + lt.debug( 'MS: last + 250: ' + ( this.lastCompletion + 250 ) ); |
| 197 | + lt.debug( 'MS: now: ' + (new Date()).getTime() ); |
| 198 | + |
| 199 | + if ( this.lastCompletion + 250 < (new Date()).getTime() ) { |
| 200 | + hits++; |
| 201 | + } |
| 202 | + else { |
| 203 | + hits = 0; |
| 204 | + } |
| 205 | + |
| 206 | + if ( hits > 4 ) { |
| 207 | + this.invokeDone(); |
| 208 | + } |
| 209 | + else if ( this.runningJobs > 0 ) { |
| 210 | + setTimeout( function() { self.checkForIdleness( hits ); }, 250 ); |
| 211 | + } |
| 212 | + } |
| 213 | + |
| 214 | + /** |
| 215 | + * Should be called every time a DOM element has been translated. |
| 216 | + * By use of the runningJobs var, completion of the translation process is detected, |
| 217 | + * and further handled by this function. |
| 218 | + */ |
| 219 | + this.handleTranslationCompletion = function() { |
| 220 | + if ( !this.checkingForIdle && this.runningJobs > 1 && this.runningJobs < 20 ) { |
| 221 | + this.checkingForIdle = true; |
| 222 | + setTimeout( function() { self.checkForIdleness( 0 ); }, 250 ); |
| 223 | + } |
| 224 | + |
| 225 | + if ( this.checkingForIdle ) { |
| 226 | + this.lastCompletion = (new Date()).getTime(); |
| 227 | + } |
| 228 | + |
| 229 | + if ( !--this.runningJobs ) { |
| 230 | + this.invokeDone(); |
| 231 | + } |
| 232 | + } |
| 233 | + |
| 234 | + |
| 235 | +}; })( jQuery, window.liveTranslate ); |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/includes/ext.lt.ms.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 236 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/includes/ext.lt.tm.js |
— | — | @@ -0,0 +1,473 @@ |
| 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 | + * This file holds the lt.memory class. |
| 10 | + */ |
| 11 | + |
| 12 | +( function( $, lt ) { |
| 13 | + |
| 14 | + /** |
| 15 | + * An lt.memory acts as abstraction layer via which special words |
| 16 | + * (words for which a translation is specified in the wiki) and |
| 17 | + * translations of those special words can be accessed. It takes |
| 18 | + * care of obtaining these via the API and utilizing caching in |
| 19 | + * memory and LocalStorage where appropriate and possible. |
| 20 | + * |
| 21 | + * @constructor |
| 22 | + * @since 1.2 |
| 23 | + */ |
| 24 | + lt.memory = function( options ) { |
| 25 | + // Words to not translate using the translation services. |
| 26 | + // { en: [foo, bar, baz], nl: [ ... ] } |
| 27 | + this.words = {}; |
| 28 | + |
| 29 | + // List of translations. |
| 30 | + // { en: { nl: { foo_en: foo_nl }, de: { bar_en: bar_de } }, nl: { ... } } |
| 31 | + this.translations = {}; |
| 32 | + |
| 33 | + this.options = { |
| 34 | + lsprefix: 'mw_lt_' |
| 35 | + }; |
| 36 | + |
| 37 | + this.cleanedLS = false; |
| 38 | + |
| 39 | + $.extend( this.options, options ); |
| 40 | + }; |
| 41 | + |
| 42 | + /** |
| 43 | + * Obtain a single instance of lt.memory. |
| 44 | + * |
| 45 | + * @since 1.2 |
| 46 | + * |
| 47 | + * @return {lt.memory} |
| 48 | + */ |
| 49 | + lt.memory.singleton = function() { |
| 50 | + if ( typeof lt.memoryinstance === 'undefined' ) { |
| 51 | + lt.memoryinstance = new lt.memory(); |
| 52 | + } |
| 53 | + |
| 54 | + return lt.memoryinstance; |
| 55 | + } |
| 56 | + |
| 57 | + lt.memory.prototype = { |
| 58 | + |
| 59 | + /** |
| 60 | + * Returns if LocalStorage can be used or not. |
| 61 | + * |
| 62 | + * @protected |
| 63 | + * @since 1.2 |
| 64 | + * |
| 65 | + * @return {boolean} |
| 66 | + */ |
| 67 | + canUseLocalStorage: function() { |
| 68 | + try { |
| 69 | + return 'localStorage' in window && window['localStorage'] !== null; |
| 70 | + } catch ( e ) { |
| 71 | + return false; |
| 72 | + } |
| 73 | + }, |
| 74 | + |
| 75 | + /** |
| 76 | + * Gets an item from localStorage. |
| 77 | + * |
| 78 | + * @protected |
| 79 | + * @since 1.2 |
| 80 | + * |
| 81 | + * @param {string} itemName The name of the item to obtain. |
| 82 | + * |
| 83 | + * @return {Object} |
| 84 | + */ |
| 85 | + obtainFromLS: function( itemName ) { |
| 86 | + return JSON.parse( localStorage.getItem( this.options.lsprefix + itemName ) ); |
| 87 | + }, |
| 88 | + |
| 89 | + /** |
| 90 | + * Writes an item to localStorage. |
| 91 | + * |
| 92 | + * @protected |
| 93 | + * @since 1.2 |
| 94 | + * |
| 95 | + * @param {string} itemName The name of the item to write. |
| 96 | + * @param {Object} object The object to write. |
| 97 | + */ |
| 98 | + writeToLS: function( itemName, object ) { |
| 99 | + localStorage.setItem( this.options.lsprefix + itemName, JSON.stringify( object ) ) |
| 100 | + }, |
| 101 | + |
| 102 | + /** |
| 103 | + * Removes an item from localStorage. |
| 104 | + * |
| 105 | + * @protected |
| 106 | + * @since 1.2 |
| 107 | + * |
| 108 | + * @param {string} itemName The name of the item to remove. |
| 109 | + */ |
| 110 | + removeFromLS: function( itemName ) { |
| 111 | + lt.debug( 'tm: removing item from LS: ' + this.options.lsprefix + itemName ); |
| 112 | + localStorage.removeItem( this.options.lsprefix + itemName ); |
| 113 | + }, |
| 114 | + |
| 115 | + /** |
| 116 | + * Obtains the translation memory hashes (via the translationmemories API query module), |
| 117 | + * needed to determine if local caches should be invalidated. |
| 118 | + * |
| 119 | + * @protected |
| 120 | + * @since 1.2 |
| 121 | + * |
| 122 | + * @param {Object} args Options |
| 123 | + * @param {Function} callback Function that will be called with the hashes once obtained. |
| 124 | + */ |
| 125 | + getMemoryHashes: function( args, callback ) { |
| 126 | + var defaults = { |
| 127 | + apiPath: window.wgScriptPath |
| 128 | + }; |
| 129 | + |
| 130 | + args = $.extend( {}, defaults, args ); |
| 131 | + |
| 132 | + $.getJSON( |
| 133 | + args.apiPath + '/api.php', |
| 134 | + { |
| 135 | + 'action': 'query', |
| 136 | + 'list': 'translationmemories', |
| 137 | + 'format': 'json', |
| 138 | + 'qtmprops': 'version_hash' |
| 139 | + }, |
| 140 | + function( data ) { |
| 141 | + if ( data.memories ) { |
| 142 | + callback( data.memories ); |
| 143 | + } |
| 144 | + else { |
| 145 | + lt.debug( 'tm: failed to fetch memory hash' ); |
| 146 | + // TODO |
| 147 | + } |
| 148 | + } |
| 149 | + ); |
| 150 | + }, |
| 151 | + |
| 152 | + /** |
| 153 | + * Compare two translation memory hashes. |
| 154 | + * |
| 155 | + * @protected |
| 156 | + * @since 1.2 |
| 157 | + * |
| 158 | + * @param {Object} a First hash |
| 159 | + * @param {Object} b Second hash |
| 160 | + * |
| 161 | + * @return {boolean} If the hashes match or not |
| 162 | + */ |
| 163 | + hashesMatch: function( a, b ) { |
| 164 | + if ( a === null || b === null ) { |
| 165 | + return false; |
| 166 | + } |
| 167 | + |
| 168 | + for ( i in a ) { |
| 169 | + if ( b[i] ) { |
| 170 | + if ( a[i].memory_version_hash !== b[i].memory_version_hash ) { |
| 171 | + return false; |
| 172 | + } |
| 173 | + } |
| 174 | + else { |
| 175 | + return false; |
| 176 | + } |
| 177 | + } |
| 178 | + |
| 179 | + for ( i in b ) { |
| 180 | + if ( !a[i] ) { |
| 181 | + return false; |
| 182 | + } |
| 183 | + } |
| 184 | + |
| 185 | + return true; |
| 186 | + }, |
| 187 | + |
| 188 | + /** |
| 189 | + * Invalidate localStorage if needed, and make sure the |
| 190 | + * hash is up to date. |
| 191 | + * |
| 192 | + * @protected |
| 193 | + * @since 1.2 |
| 194 | + * |
| 195 | + * @param {Object} options Options |
| 196 | + * @param {Function} callback Called when localStorage has been cleaned. |
| 197 | + */ |
| 198 | + cleanLocalStorage: function( options, callback ) { |
| 199 | + options = $.extend( {}, { forceCheck: false }, options ); |
| 200 | + |
| 201 | + if ( this.cleanedLS && !options.forceCheck ) { |
| 202 | + callback(); |
| 203 | + } |
| 204 | + else { |
| 205 | + var _this = this; |
| 206 | + lt.debug( 'tm: getting memory hashes' ); |
| 207 | + |
| 208 | + this.getMemoryHashes( |
| 209 | + {}, |
| 210 | + function( memories ) { |
| 211 | + if ( _this.hashesMatch( _this.obtainFromLS( 'hash' ), memories ) ) { |
| 212 | + lt.debug( 'tm: memory hashes obtained: match' ); |
| 213 | + } |
| 214 | + else { |
| 215 | + _this.removeFromLS( 'words' ); |
| 216 | + _this.removeFromLS( 'translations' ); |
| 217 | + _this.writeToLS( 'hash', memories ); |
| 218 | + lt.debug( 'tm: memory hashes obtained: no match; LS cleared' ); |
| 219 | + } |
| 220 | + |
| 221 | + _this.cleanedLS = true; |
| 222 | + callback(); |
| 223 | + } |
| 224 | + ); |
| 225 | + } |
| 226 | + }, |
| 227 | + |
| 228 | + /** |
| 229 | + * Fetches translations for the specified words from the server using the livetranslate API module. |
| 230 | + * |
| 231 | + * @protected |
| 232 | + * @since 1.2 |
| 233 | + * |
| 234 | + * @param {Object} args Options |
| 235 | + * @param {Function} callback Function that will be called with the translations once obtained. |
| 236 | + */ |
| 237 | + obtainTranslationsFromServer: function( args, callback ) { |
| 238 | + var defaults = { |
| 239 | + offset: -1, |
| 240 | + words: [], |
| 241 | + language: 'en', |
| 242 | + apiPath: window.wgScriptPath |
| 243 | + }; |
| 244 | + |
| 245 | + args = $.extend( {}, defaults, args ); |
| 246 | + |
| 247 | + lt.debug( 'tm: obtaining translations from server' ); |
| 248 | + |
| 249 | + $.getJSON( |
| 250 | + args.apiPath + '/api.php', |
| 251 | + { |
| 252 | + 'action': 'livetranslate', |
| 253 | + 'format': 'json', |
| 254 | + 'from': args.source, |
| 255 | + 'to': args.target, |
| 256 | + 'words': args.words.join( '|' ) |
| 257 | + }, |
| 258 | + function( data ) { |
| 259 | + if ( data.translations ) { |
| 260 | + lt.debug( 'tm: obtained translations from server' ); |
| 261 | + callback( data.translations ); |
| 262 | + } |
| 263 | + else { |
| 264 | + // TODO |
| 265 | + } |
| 266 | + } |
| 267 | + ); |
| 268 | + }, |
| 269 | + |
| 270 | + /** |
| 271 | + * Fetches words for the specified words from the server using the livetranslate API query module. |
| 272 | + * |
| 273 | + * @protected |
| 274 | + * @since 1.2 |
| 275 | + * |
| 276 | + * @param {Object} args Options |
| 277 | + * @param {Function} callback Function that will be called with the words once obtained. |
| 278 | + */ |
| 279 | + obtainWordsFromServer: function( args, callback ) { |
| 280 | + var _this = this; |
| 281 | + |
| 282 | + var defaults = { |
| 283 | + offset: -1, |
| 284 | + allWords: [], |
| 285 | + language: 'en', |
| 286 | + apiPath: window.wgScriptPath |
| 287 | + }; |
| 288 | + |
| 289 | + args = $.extend( {}, defaults, args ); |
| 290 | + |
| 291 | + lt.debug( 'tm: obtaining special words from server, offset ' + args.offset ); |
| 292 | + |
| 293 | + var requestArgs = { |
| 294 | + 'action': 'query', |
| 295 | + 'format': 'json', |
| 296 | + 'list': 'livetranslate', |
| 297 | + 'ltlanguage': args.language |
| 298 | + }; |
| 299 | + |
| 300 | + if ( args.offset > 0 ) { |
| 301 | + requestArgs['ltcontinue'] = args.offset; |
| 302 | + } |
| 303 | + |
| 304 | + $.getJSON( |
| 305 | + args.apiPath + '/api.php', |
| 306 | + requestArgs, |
| 307 | + function( data ) { |
| 308 | + if ( data.words ) { |
| 309 | + args.allWords.push.apply( args.allWords, data.words ); |
| 310 | + } |
| 311 | + else { |
| 312 | + // TODO |
| 313 | + } |
| 314 | + |
| 315 | + if ( data['query-continue'] ) { |
| 316 | + _this.obtainWordsFromServer( |
| 317 | + { |
| 318 | + offset: data['query-continue'].livetranslate.ltcontinue, |
| 319 | + language: args.language, |
| 320 | + allWords: args.allWords |
| 321 | + }, |
| 322 | + callback |
| 323 | + ); |
| 324 | + } |
| 325 | + else { |
| 326 | + lt.debug( 'tm: obtained special words from server' ); |
| 327 | + callback( args.allWords ); |
| 328 | + } |
| 329 | + } |
| 330 | + ); |
| 331 | + }, |
| 332 | + |
| 333 | + /** |
| 334 | + * Gets translations of the specified words in the specified language to |
| 335 | + * the specified language. |
| 336 | + * |
| 337 | + * @since 1.2 |
| 338 | + * |
| 339 | + * @param {Object} args Options |
| 340 | + * @param {Function} callback Function that will be called with the translations once obtained. |
| 341 | + */ |
| 342 | + getTranslations: function( args, callback ) { |
| 343 | + var _this = this; |
| 344 | + |
| 345 | + var defaults = { |
| 346 | + source: 'en', |
| 347 | + target: 'en', |
| 348 | + words: [] |
| 349 | + }; |
| 350 | + |
| 351 | + var translations = {}; |
| 352 | + |
| 353 | + args = $.extend( {}, defaults, args ); |
| 354 | + |
| 355 | + if ( !this.translations[args.source] ) { |
| 356 | + this.translations[args.source] = {}; |
| 357 | + } |
| 358 | + |
| 359 | + var mergeInTranslations = function( words ) { |
| 360 | + lt.debug( 'tm: merging in translations' ); |
| 361 | + var wordsAdded = []; |
| 362 | + |
| 363 | + $.each( args.words, function( index, word ) { |
| 364 | + if ( !!words[word] ) { |
| 365 | + translations[word] = words[word]; |
| 366 | + _this.translations[args.source][args.target][word] = words[word]; |
| 367 | + wordsAdded.push( index ); |
| 368 | + } |
| 369 | + } ); |
| 370 | + |
| 371 | + args.words = $.grep( args.words, function( e, index ) { |
| 372 | + return $.inArray( index, wordsAdded ) === -1; |
| 373 | + } ); |
| 374 | + }; |
| 375 | + |
| 376 | + var getFromServer = function() { |
| 377 | + _this.obtainTranslationsFromServer( args, function( obtainedTranslations ) { |
| 378 | + mergeInTranslations( obtainedTranslations ); |
| 379 | + |
| 380 | + if ( _this.canUseLocalStorage() ) { |
| 381 | + _this.writeToLS( 'translations', _this.translations ); |
| 382 | + lt.debug( 'tm: wrote translations to LS' ); |
| 383 | + } |
| 384 | + |
| 385 | + callback( translations ); |
| 386 | + } ); |
| 387 | + }; |
| 388 | + |
| 389 | + if ( this.translations[args.source][args.target] ) { |
| 390 | + mergeInTranslations( this.translations[args.source][args.target] ); |
| 391 | + } |
| 392 | + else { |
| 393 | + this.translations[args.source][args.target] = {}; |
| 394 | + } |
| 395 | + |
| 396 | + if ( args.words.length == 0 ) { |
| 397 | + callback( translations ); |
| 398 | + } |
| 399 | + else { |
| 400 | + if ( this.canUseLocalStorage() ) { |
| 401 | + this.cleanLocalStorage( {}, function() { |
| 402 | + var lsTranslations = _this.obtainFromLS( 'translations' ); |
| 403 | + |
| 404 | + if ( lsTranslations !== null && lsTranslations[args.source] && lsTranslations[args.source][args.target] ) { |
| 405 | + mergeInTranslations( lsTranslations[args.source][args.target] ); |
| 406 | + } |
| 407 | + |
| 408 | + if ( args.words.length == 0 ) { |
| 409 | + callback( translations ); |
| 410 | + } |
| 411 | + else { |
| 412 | + getFromServer(); |
| 413 | + } |
| 414 | + } ); |
| 415 | + } |
| 416 | + else { |
| 417 | + getFromServer(); |
| 418 | + } |
| 419 | + } |
| 420 | + }, |
| 421 | + |
| 422 | + /** |
| 423 | + * Gets the special words for the specified language, ie words that have local translations. |
| 424 | + * |
| 425 | + * @since 1.2 |
| 426 | + * |
| 427 | + * @param {string} language |
| 428 | + * @param {Function} callback Function that will be called with the words once obtained. |
| 429 | + */ |
| 430 | + getSpecialWords: function( language, callback ) { |
| 431 | + var _this = this; |
| 432 | + |
| 433 | + var getFromServer = function() { |
| 434 | + _this.obtainWordsFromServer( |
| 435 | + { |
| 436 | + language: language |
| 437 | + }, |
| 438 | + function( words ) { |
| 439 | + _this.words[language] = words; |
| 440 | + |
| 441 | + if ( _this.canUseLocalStorage() ) { |
| 442 | + _this.writeToLS( 'words', _this.words ); |
| 443 | + lt.debug( 'tm: wrote special words to LS' ); |
| 444 | + } |
| 445 | + |
| 446 | + callback( words ); |
| 447 | + } |
| 448 | + ); |
| 449 | + }; |
| 450 | + |
| 451 | + if ( this.words[language] ) { |
| 452 | + callback( this.words[language] ); |
| 453 | + } |
| 454 | + else { |
| 455 | + if ( this.canUseLocalStorage() ) { |
| 456 | + this.cleanLocalStorage( {}, function() { |
| 457 | + var words = _this.obtainFromLS( 'words' ); |
| 458 | + |
| 459 | + if ( words !== null && words[language] ) { |
| 460 | + callback( words[language] ); |
| 461 | + } |
| 462 | + else { |
| 463 | + getFromServer(); |
| 464 | + } |
| 465 | + } ); |
| 466 | + } |
| 467 | + else { |
| 468 | + getFromServer(); |
| 469 | + } |
| 470 | + } |
| 471 | + } |
| 472 | + }; |
| 473 | + |
| 474 | +}) ( jQuery, window.liveTranslate ); |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/includes/ext.lt.tm.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 475 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/includes/jquery.replaceText.js |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +/* |
| 3 | + * jQuery replaceText - v1.1 - 11/21/2009 |
| 4 | + * http://benalman.com/projects/jquery-replacetext-plugin/ |
| 5 | + * |
| 6 | + * Copyright (c) 2009 "Cowboy" Ben Alman |
| 7 | + * Dual licensed under the MIT and GPL licenses. |
| 8 | + * http://benalman.com/about/license/ |
| 9 | + */ |
| 10 | +( function ( $ ) { |
| 11 | + $.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()})}; |
| 12 | +} )( jQuery ); |
| 13 | + |
| 14 | +/** |
| 15 | + * Regex text escaping function. |
| 16 | + * Borrowed from http://simonwillison.net/2006/Jan/20/escape/ |
| 17 | + */ |
| 18 | +RegExp.escape = function( text ) { |
| 19 | + if ( !arguments.callee.sRE ) { |
| 20 | + var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\' ]; |
| 21 | + arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' ); |
| 22 | + } |
| 23 | + return text.replace(arguments.callee.sRE, '\\$1'); |
| 24 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/includes/jquery.replaceText.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/includes/LT_TMXParser.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 197 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/includes/LiveTranslate_Functions.php |
— | — | @@ -0,0 +1,415 @@ |
| 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 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.lt.tm.js' ) . |
| 66 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/jquery.replaceText.js' ) . |
| 67 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/jquery.liveTranslate.js' ) |
| 68 | + ); |
| 69 | + |
| 70 | + switch( $GLOBALS['egLiveTranslateService'] ) { |
| 71 | + case LTS_GOOGLE: |
| 72 | + $wgOut->addHeadItem( |
| 73 | + 'ext.lt.google.jsapi', |
| 74 | + Html::linkedScript( 'https://www.google.com/jsapi?key=' . htmlspecialchars( $GLOBALS['egGoogleApiKey'] ) ) |
| 75 | + ); |
| 76 | + |
| 77 | + $wgOut->addHeadItem( |
| 78 | + 'ext.lt.google', |
| 79 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.lt.google.js' ) |
| 80 | + ); |
| 81 | + break; |
| 82 | + case LTS_MS: |
| 83 | + $wgOut->addScript( |
| 84 | + Html::inlineScript( |
| 85 | + 'var ltMsAppId = ' . FormatJson::encode( $GLOBALS['egLiveTranslateMSAppId'] ) . ';' |
| 86 | + ) |
| 87 | + ); |
| 88 | + $wgOut->addHeadItem( |
| 89 | + 'ext.lt.ms', |
| 90 | + Html::linkedScript( $egLiveTranslateScriptPath . '/includes/ext.lt.ms.js' ) |
| 91 | + ); |
| 92 | + break; |
| 93 | + } |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + /** |
| 98 | + * Adds the needed JS messages to the page output. |
| 99 | + * This is for backward compatibility with pre-RL MediaWiki. |
| 100 | + * |
| 101 | + * @since 0.1 |
| 102 | + */ |
| 103 | + protected static function addJSLocalisation() { |
| 104 | + global $egLTJSMessages, $wgOut; |
| 105 | + |
| 106 | + $data = array(); |
| 107 | + |
| 108 | + foreach ( $egLTJSMessages as $msg ) { |
| 109 | + $data[$msg] = wfMsgNoTrans( $msg ); |
| 110 | + } |
| 111 | + |
| 112 | + $wgOut->addInlineScript( 'var wgLTEMessages = ' . FormatJson::encode( $data ) . ';' ); |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * Returns the language code for a title. |
| 117 | + * |
| 118 | + * @param Title $title |
| 119 | + * |
| 120 | + * @return string |
| 121 | + */ |
| 122 | + public static function getCurrentLang( Title $title ) { |
| 123 | + $subPage = explode( '/', $title->getSubpageText() ); |
| 124 | + $subPage = array_pop( $subPage ); |
| 125 | + |
| 126 | + if ( $subPage != '' && array_key_exists( $subPage, Language::getLanguageNames( false ) ) ) { |
| 127 | + return $subPage; |
| 128 | + } |
| 129 | + |
| 130 | + global $wgLanguageCode; |
| 131 | + return $wgLanguageCode; |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * Returns a list of languages that can be translated to. |
| 136 | + * |
| 137 | + * @since 1.2 |
| 138 | + * |
| 139 | + * @param string $currentLang |
| 140 | + * |
| 141 | + * @return array |
| 142 | + */ |
| 143 | + public static function getLanguages( $currentLang ) { |
| 144 | + global $wgUser, $wgLanguageCode, $egLiveTranslateLanguages; |
| 145 | + |
| 146 | + $allowedLanguages = array_merge( $egLiveTranslateLanguages, array( $currentLang ) ); |
| 147 | + |
| 148 | + $targetLang = $wgLanguageCode; |
| 149 | + |
| 150 | + $languages = Language::getLanguageNames( false ); |
| 151 | + |
| 152 | + if ( $wgUser->isLoggedIn() ) { |
| 153 | + $userLang = $wgUser->getOption( 'language' ); |
| 154 | + |
| 155 | + if ( array_key_exists( $userLang, $languages ) && in_array( $userLang, $allowedLanguages ) ) { |
| 156 | + $targetLang = $userLang; |
| 157 | + } |
| 158 | + } |
| 159 | + |
| 160 | + $options = array(); |
| 161 | + ksort( $languages ); |
| 162 | + |
| 163 | + foreach ( $languages as $code => $name ) { |
| 164 | + if ( in_array( $code, $allowedLanguages ) && $code != $currentLang ) { |
| 165 | + $display = wfBCP47( $code ) . ' - ' . $name; |
| 166 | + $options[$display] = $code; |
| 167 | + } |
| 168 | + } |
| 169 | + |
| 170 | + return $options; |
| 171 | + } |
| 172 | + |
| 173 | + /** |
| 174 | + * Returns a PHP version of the JavaScript google.language.Languages enum of the Google Translate v1 API. |
| 175 | + * @see https://code.google.com/apis/language/translate/v1/getting_started.html#LangNameArray |
| 176 | + * |
| 177 | + * @since 0.1 |
| 178 | + * |
| 179 | + * @return array LANGUAGE_NAME => 'code' |
| 180 | + */ |
| 181 | + public static function getGTSupportedLanguages() { |
| 182 | + return array( |
| 183 | + 'AFRIKAANS' => 'af', |
| 184 | + 'ALBANIAN' => 'sq', |
| 185 | + 'AMHARIC' => 'am', |
| 186 | + 'ARABIC' => 'ar', |
| 187 | + 'ARMENIAN' => 'hy', |
| 188 | + 'AZERBAIJANI' => 'az', |
| 189 | + 'BASQUE' => 'eu', |
| 190 | + 'BELARUSIAN' => 'be', |
| 191 | + 'BENGALI' => 'bn', |
| 192 | + 'BIHARI' => 'bh', |
| 193 | + 'BRETON' => 'br', |
| 194 | + 'BULGARIAN' => 'bg', |
| 195 | + 'BURMESE' => 'my', |
| 196 | + 'CATALAN' => 'ca', |
| 197 | + 'CHEROKEE' => 'chr', |
| 198 | + 'CHINESE' => 'zh', |
| 199 | + 'CHINESE_SIMPLIFIED' => 'zh-CN', |
| 200 | + 'CHINESE_TRADITIONAL' => 'zh-TW', |
| 201 | + 'CORSICAN' => 'co', |
| 202 | + 'CROATIAN' => 'hr', |
| 203 | + 'CZECH' => 'cs', |
| 204 | + 'DANISH' => 'da', |
| 205 | + 'DHIVEHI' => 'dv', |
| 206 | + 'DUTCH'=> 'nl', |
| 207 | + 'ENGLISH' => 'en', |
| 208 | + 'ESPERANTO' => 'eo', |
| 209 | + 'ESTONIAN' => 'et', |
| 210 | + 'FAROESE' => 'fo', |
| 211 | + 'FILIPINO' => 'tl', |
| 212 | + 'FINNISH' => 'fi', |
| 213 | + 'FRENCH' => 'fr', |
| 214 | + 'FRISIAN' => 'fy', |
| 215 | + 'GALICIAN' => 'gl', |
| 216 | + 'GEORGIAN' => 'ka', |
| 217 | + 'GERMAN' => 'de', |
| 218 | + 'GREEK' => 'el', |
| 219 | + 'GUJARATI' => 'gu', |
| 220 | + 'HAITIAN_CREOLE' => 'ht', |
| 221 | + 'HEBREW' => 'iw', |
| 222 | + 'HINDI' => 'hi', |
| 223 | + 'HUNGARIAN' => 'hu', |
| 224 | + 'ICELANDIC' => 'is', |
| 225 | + 'INDONESIAN' => 'id', |
| 226 | + 'INUKTITUT' => 'iu', |
| 227 | + 'IRISH' => 'ga', |
| 228 | + 'ITALIAN' => 'it', |
| 229 | + 'JAPANESE' => 'ja', |
| 230 | + 'JAVANESE' => 'jw', |
| 231 | + 'KANNADA' => 'kn', |
| 232 | + 'KAZAKH' => 'kk', |
| 233 | + 'KHMER' => 'km', |
| 234 | + 'KOREAN' => 'ko', |
| 235 | + 'KURDISH'=> 'ku', |
| 236 | + 'KYRGYZ'=> 'ky', |
| 237 | + 'LAO' => 'lo', |
| 238 | + 'LATIN' => 'la', |
| 239 | + 'LATVIAN' => 'lv', |
| 240 | + 'LITHUANIAN' => 'lt', |
| 241 | + 'LUXEMBOURGISH' => 'lb', |
| 242 | + 'MACEDONIAN' => 'mk', |
| 243 | + 'MALAY' => 'ms', |
| 244 | + 'MALAYALAM' => 'ml', |
| 245 | + 'MALTESE' => 'mt', |
| 246 | + 'MAORI' => 'mi', |
| 247 | + 'MARATHI' => 'mr', |
| 248 | + 'MONGOLIAN' => 'mn', |
| 249 | + 'NEPALI' => 'ne', |
| 250 | + 'NORWEGIAN' => 'no', |
| 251 | + 'OCCITAN' => 'oc', |
| 252 | + 'ORIYA' => 'or', |
| 253 | + 'PASHTO' => 'ps', |
| 254 | + 'PERSIAN' => 'fa', |
| 255 | + 'POLISH' => 'pl', |
| 256 | + 'PORTUGUESE' => 'pt', |
| 257 | + 'PORTUGUESE_PORTUGAL' => 'pt-PT', |
| 258 | + 'PUNJABI' => 'pa', |
| 259 | + 'QUECHUA' => 'qu', |
| 260 | + 'ROMANIAN' => 'ro', |
| 261 | + 'RUSSIAN' => 'ru', |
| 262 | + 'SANSKRIT' => 'sa', |
| 263 | + 'SCOTS_GAELIC' => 'gd', |
| 264 | + 'SERBIAN' => 'sr', |
| 265 | + 'SINDHI' => 'sd', |
| 266 | + 'SINHALESE' => 'si', |
| 267 | + 'SLOVAK' => 'sk', |
| 268 | + 'SLOVENIAN' => 'sl', |
| 269 | + 'SPANISH' => 'es', |
| 270 | + 'SUNDANESE' => 'su', |
| 271 | + 'SWAHILI' => 'sw', |
| 272 | + 'SWEDISH' => 'sv', |
| 273 | + 'SYRIAC' => 'syr', |
| 274 | + 'TAJIK' => 'tg', |
| 275 | + 'TAMIL' => 'ta', |
| 276 | + 'TATAR' => 'tt', |
| 277 | + 'TELUGU' => 'te', |
| 278 | + 'THAI' => 'th', |
| 279 | + 'TIBETAN' => 'bo', |
| 280 | + 'TONGA' => 'to', |
| 281 | + 'TURKISH' => 'tr', |
| 282 | + 'UKRAINIAN' => 'uk', |
| 283 | + 'URDU' => 'ur', |
| 284 | + 'UZBEK' => 'uz', |
| 285 | + 'UIGHUR' => 'ug', |
| 286 | + 'VIETNAMESE' => 'vi', |
| 287 | + 'WELSH' => 'cy', |
| 288 | + 'YIDDISH' => 'yi', |
| 289 | + 'YORUBA' => 'yo', |
| 290 | + ); |
| 291 | + } |
| 292 | + |
| 293 | + /** |
| 294 | + * Returns an array with mapping from input language codes to MediaWiki language codes. |
| 295 | + * |
| 296 | + * @since 0.4 |
| 297 | + * |
| 298 | + * @return array |
| 299 | + */ |
| 300 | + public static function getInputLangMapping() { |
| 301 | + return array( |
| 302 | + 'en-us' => 'en', |
| 303 | + ); |
| 304 | + } |
| 305 | + |
| 306 | + /** |
| 307 | + * Returns an array with mapping from MediaWiki language codes to Google Translate language codes. |
| 308 | + * |
| 309 | + * @since 0.4 |
| 310 | + * |
| 311 | + * @return array |
| 312 | + */ |
| 313 | + public static function getOuputLangMapping() { |
| 314 | + return array( |
| 315 | + 'en-us' => 'en', |
| 316 | + 'en-gb' => 'en', |
| 317 | + ); |
| 318 | + } |
| 319 | + |
| 320 | + /** |
| 321 | + * Returns the provided text starting with a letter in toggled case. |
| 322 | + * If there is no difference between lowercase and upercase for the first |
| 323 | + * character, false is returned. |
| 324 | + * |
| 325 | + * @since 0.1 |
| 326 | + * |
| 327 | + * @param string $text |
| 328 | + * |
| 329 | + * @return mixed |
| 330 | + */ |
| 331 | + public static function getToggledCase( $text ) { |
| 332 | + $isUpper = Language::firstChar( $text) == strtoupper( Language::firstChar( $text) ); |
| 333 | + $isLower = Language::firstChar( $text) == strtolower( Language::firstChar( $text) ); |
| 334 | + |
| 335 | + if ( $isUpper XOR $isLower ) { |
| 336 | + $text = $isUpper ? Language::lcfirst( $text ) : Language::ucfirst( $text ); |
| 337 | + return $text; |
| 338 | + } |
| 339 | + else { |
| 340 | + return false; |
| 341 | + } |
| 342 | + } |
| 343 | + |
| 344 | + /** |
| 345 | + * Returns the names of the pages containing a translation memory. |
| 346 | + * |
| 347 | + * @since 0.4 |
| 348 | + * |
| 349 | + * @return array |
| 350 | + */ |
| 351 | + public static function getLocalMemoryNames() { |
| 352 | + $dbr = wfGetDb( DB_MASTER ); |
| 353 | + |
| 354 | + $res = $dbr->select( |
| 355 | + 'live_translate_memories', |
| 356 | + array( 'memory_location' ), |
| 357 | + array( 'memory_local' => 1 ), |
| 358 | + __METHOD__, |
| 359 | + array( 'LIMIT' => '5000' ) |
| 360 | + ); |
| 361 | + |
| 362 | + $names = array(); |
| 363 | + |
| 364 | + foreach ( $res as $tm ) { |
| 365 | + $names[] = $tm->memory_location; |
| 366 | + } |
| 367 | + |
| 368 | + return $names; |
| 369 | + } |
| 370 | + |
| 371 | + /** |
| 372 | + * Returns the type of a translation memory when given it's location. |
| 373 | + * If the memory is not found, -1 is returned. |
| 374 | + * |
| 375 | + * @since 0.4 |
| 376 | + * |
| 377 | + * @param string $location |
| 378 | + * |
| 379 | + * @return integer |
| 380 | + */ |
| 381 | + public static function getMemoryType( $location ) { |
| 382 | + $dbr = wfGetDb( DB_MASTER ); |
| 383 | + |
| 384 | + $res = $dbr->select( |
| 385 | + 'live_translate_memories', |
| 386 | + array( 'memory_type' ), |
| 387 | + array( 'memory_location' => $location ), |
| 388 | + __METHOD__, |
| 389 | + array( 'LIMIT' => '5000' ) |
| 390 | + ); |
| 391 | + |
| 392 | + $type = -1; |
| 393 | + |
| 394 | + foreach ( $res as $row ) { |
| 395 | + $type = $row->memory_type; |
| 396 | + break; |
| 397 | + } |
| 398 | + |
| 399 | + return $type; |
| 400 | + } |
| 401 | + |
| 402 | + /** |
| 403 | + * Returns if there is a translation service that can be used or not. |
| 404 | + * |
| 405 | + * @since 1.1.1 |
| 406 | + * |
| 407 | + * @return boolean |
| 408 | + */ |
| 409 | + public static function hasTranslationService() { |
| 410 | + global $egLiveTranslateService, $egGoogleApiKey, $egLiveTranslateMSAppId; |
| 411 | + |
| 412 | + return ( $egLiveTranslateService == LTS_GOOGLE && $egGoogleApiKey != '' ) |
| 413 | + || ( $egLiveTranslateService == LTS_MS && $egLiveTranslateMSAppId != '' ); |
| 414 | + } |
| 415 | + |
| 416 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/includes/LiveTranslate_Functions.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 417 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/includes/LT_TranslationMemory.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 78 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/COPYING |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 684 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate.i18n.alias.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Aliases for the special pages of the Live Translate extension. |
| 6 | + * |
| 7 | + * @file LiveTranslate.i18n.alias.php |
| 8 | + * @ingroup LiveTranslate |
| 9 | + * |
| 10 | + * @licence GNU GPL v3+ |
| 11 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 12 | + */ |
| 13 | + |
| 14 | +$specialPageAliases = array(); |
| 15 | + |
| 16 | +/** English (English) */ |
| 17 | +$specialPageAliases['en'] = array( |
| 18 | + 'LiveTranslate' => array( 'LiveTranslate' ), |
| 19 | +); |
| 20 | + |
| 21 | +/** |
| 22 | + * For backwards compatibility with MediaWiki 1.15 and earlier. |
| 23 | + */ |
| 24 | +$aliases =& $specialPageAliases; |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate.i18n.alias.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/api/ApiQueryLiveTranslate.php |
— | — | @@ -0,0 +1,148 @@ |
| 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 | + * @licence GNU GPL v3+ |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class ApiQueryLiveTranslate extends ApiQueryBase { |
| 16 | + public function __construct( $main, $action ) { |
| 17 | + parent :: __construct( $main, $action, 'lt' ); |
| 18 | + } |
| 19 | + |
| 20 | + /** |
| 21 | + * Retrieve the specil words from the database. |
| 22 | + */ |
| 23 | + public function execute() { |
| 24 | + // Get the requests parameters. |
| 25 | + $params = $this->extractRequestParams(); |
| 26 | + |
| 27 | + if ( !isset( $params['language'] ) ) { |
| 28 | + $this->dieUsageMsg( array( 'missingparam', 'language' ) ); |
| 29 | + } |
| 30 | + |
| 31 | + $this->addTables( 'live_translate' ); |
| 32 | + |
| 33 | + $this->addFields( array( |
| 34 | + 'word_id', |
| 35 | + 'word_translation' |
| 36 | + ) ); |
| 37 | + |
| 38 | + $this->addWhere( array( |
| 39 | + 'word_language' => $params['language'] |
| 40 | + ) ); |
| 41 | + |
| 42 | + if ( !is_null( $params['continue'] ) ) { |
| 43 | + $dbr = wfGetDB( DB_SLAVE ); |
| 44 | + $this->addWhere( 'word_id >= ' . $dbr->addQuotes( $params['continue'] ) ); |
| 45 | + } |
| 46 | + |
| 47 | + $this->addOption( 'LIMIT', $params['limit'] + 1 ); |
| 48 | + $this->addOption( 'ORDER BY', 'word_id ASC' ); |
| 49 | + |
| 50 | + $words = $this->select( __METHOD__ ); |
| 51 | + $specialWords = array(); |
| 52 | + $count = 0; |
| 53 | + |
| 54 | + while ( $word = $words->fetchObject() ) { |
| 55 | + if ( ++$count > $params['limit'] ) { |
| 56 | + // We've reached the one extra which shows that |
| 57 | + // there are additional pages to be had. Stop here... |
| 58 | + $this->setContinueEnumParameter( 'continue', $word->word_id ); |
| 59 | + break; |
| 60 | + } |
| 61 | + |
| 62 | + $specialWords[] = $word->word_translation; |
| 63 | + } |
| 64 | + |
| 65 | + $toggeledSpecials = array(); |
| 66 | + |
| 67 | + foreach ( $specialWords as $word ) { |
| 68 | + $toggledWord = LiveTranslateFunctions::getToggledCase( $word ); |
| 69 | + |
| 70 | + if ( $toggledWord ) { |
| 71 | + $toggeledSpecials[] = $toggledWord; |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + foreach ( array_unique( array_merge( $specialWords, $toggeledSpecials ) ) as $word ) { |
| 76 | + $this->getResult()->addValue( |
| 77 | + 'words', |
| 78 | + null, |
| 79 | + $word |
| 80 | + ); |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * (non-PHPdoc) |
| 86 | + * @see includes/api/ApiBase#getAllowedParams() |
| 87 | + */ |
| 88 | + public function getAllowedParams() { |
| 89 | + return array ( |
| 90 | + 'language' => array( |
| 91 | + ApiBase::PARAM_TYPE => 'string', |
| 92 | + //ApiBase::PARAM_REQUIRED => true, |
| 93 | + ), |
| 94 | + 'limit' => array( |
| 95 | + ApiBase :: PARAM_DFLT => 500, |
| 96 | + ApiBase :: PARAM_TYPE => 'limit', |
| 97 | + ApiBase :: PARAM_MIN => 1, |
| 98 | + ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1, |
| 99 | + ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2 |
| 100 | + ), |
| 101 | + 'continue' => null, |
| 102 | + ); |
| 103 | + } |
| 104 | + |
| 105 | + /** |
| 106 | + * (non-PHPdoc) |
| 107 | + * @see includes/api/ApiBase#getParamDescription() |
| 108 | + */ |
| 109 | + public function getParamDescription() { |
| 110 | + return array ( |
| 111 | + 'language' => 'The language for which to return special words', |
| 112 | + 'continue' => 'Offset number from where to continue the query', |
| 113 | + 'limit' => 'Max amount of words to return', |
| 114 | + ); |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * (non-PHPdoc) |
| 119 | + * @see includes/api/ApiBase#getDescription() |
| 120 | + */ |
| 121 | + public function getDescription() { |
| 122 | + return 'This module returns all special words defined in the wikis Live Translate Dictionary for a given language'; |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * (non-PHPdoc) |
| 127 | + * @see includes/api/ApiBase#getPossibleErrors() |
| 128 | + */ |
| 129 | + public function getPossibleErrors() { |
| 130 | + return array_merge( parent::getPossibleErrors(), array( |
| 131 | + array( 'missingparam', 'language' ), |
| 132 | + ) ); |
| 133 | + } |
| 134 | + |
| 135 | + /** |
| 136 | + * (non-PHPdoc) |
| 137 | + * @see includes/api/ApiBase#getExamples() |
| 138 | + */ |
| 139 | + protected function getExamples() { |
| 140 | + return array ( |
| 141 | + 'api.php?action=query&list=livetranslate<language', |
| 142 | + ); |
| 143 | + } |
| 144 | + |
| 145 | + public function getVersion() { |
| 146 | + return __CLASS__ . ': $Id$'; |
| 147 | + } |
| 148 | + |
| 149 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/api/ApiQueryLiveTranslate.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 150 | + Id |
Added: svn:eol-style |
2 | 151 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/api/ApiQueryTranslationMemories.php |
— | — | @@ -0,0 +1,156 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * API module to get a list of translation memories. |
| 6 | + * |
| 7 | + * @since 1.2 |
| 8 | + * |
| 9 | + * @file ApiQueryLiveTranslate.php |
| 10 | + * @ingroup LiveTranslate |
| 11 | + * |
| 12 | + * @licence GNU GPL v3+ |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class ApiQueryTranslationMemories extends ApiQueryBase { |
| 16 | + |
| 17 | + public function __construct( $main, $action ) { |
| 18 | + parent :: __construct( $main, $action, 'qtm' ); |
| 19 | + } |
| 20 | + |
| 21 | + /** |
| 22 | + * Retrieve the specil words from the database. |
| 23 | + */ |
| 24 | + public function execute() { |
| 25 | + // Get the requests parameters. |
| 26 | + $params = $this->extractRequestParams(); |
| 27 | + |
| 28 | + $this->addTables( 'live_translate_memories' ); |
| 29 | + |
| 30 | + if ( !in_array( 'id', $params ) ) { |
| 31 | + $this->addFields( 'memory_id' ); |
| 32 | + } |
| 33 | + |
| 34 | + foreach ( $params['props'] as &$prop ) { |
| 35 | + $prop = "memory_$prop"; |
| 36 | + } |
| 37 | + |
| 38 | + $this->addFields( $params['props'] ); |
| 39 | + |
| 40 | + if ( count( $params['ids'] ) > 0 ) { |
| 41 | + $this->addWhere( array( |
| 42 | + 'memory_id' => $params['ids'] |
| 43 | + ) ); |
| 44 | + } |
| 45 | + |
| 46 | + if ( !is_null( $params['continue'] ) ) { |
| 47 | + $dbr = wfGetDB( DB_SLAVE ); |
| 48 | + $this->addWhere( 'memory_id >= ' . $dbr->addQuotes( $params['continue'] ) ); |
| 49 | + } |
| 50 | + |
| 51 | + $this->addOption( 'LIMIT', $params['limit'] + 1 ); |
| 52 | + $this->addOption( 'ORDER BY', 'memory_id ASC' ); |
| 53 | + |
| 54 | + $memories = $this->select( __METHOD__ ); |
| 55 | + $resultMemories = array(); |
| 56 | + $count = 0; |
| 57 | + |
| 58 | + while ( $memory = $memories->fetchObject() ) { |
| 59 | + if ( ++$count > $params['limit'] ) { |
| 60 | + // We've reached the one extra which shows that |
| 61 | + // there are additional pages to be had. Stop here... |
| 62 | + $this->setContinueEnumParameter( 'continue', $memory->memory_id ); |
| 63 | + break; |
| 64 | + } |
| 65 | + |
| 66 | + $resultMemories[$memory->memory_id] = (array)$memory; |
| 67 | + } |
| 68 | + |
| 69 | + $this->getResult()->setIndexedTagName( $resultMemories, 'memory' ); |
| 70 | + |
| 71 | + $this->getResult()->addValue( |
| 72 | + null, |
| 73 | + 'memories', |
| 74 | + $resultMemories |
| 75 | + ); |
| 76 | + } |
| 77 | + |
| 78 | + /** |
| 79 | + * (non-PHPdoc) |
| 80 | + * @see includes/api/ApiBase#getAllowedParams() |
| 81 | + */ |
| 82 | + public function getAllowedParams() { |
| 83 | + return array ( |
| 84 | + 'props' => array( |
| 85 | + ApiBase::PARAM_DFLT => 'id|type|location|local|lang_count|tu_count|version_hash', |
| 86 | + ApiBase::PARAM_ISMULTI => true, |
| 87 | + ApiBase::PARAM_TYPE => array( |
| 88 | + 'id', |
| 89 | + 'type', |
| 90 | + 'location', |
| 91 | + 'local', |
| 92 | + 'lang_count', |
| 93 | + 'tu_count', |
| 94 | + 'version_hash', |
| 95 | + ), |
| 96 | + ), |
| 97 | + 'ids' => array( |
| 98 | + ApiBase::PARAM_DFLT => '', |
| 99 | + ApiBase::PARAM_ISMULTI => true, |
| 100 | + ApiBase::PARAM_TYPE => 'integer', |
| 101 | + ), |
| 102 | + 'limit' => array( |
| 103 | + ApiBase :: PARAM_DFLT => 500, |
| 104 | + ApiBase :: PARAM_TYPE => 'limit', |
| 105 | + ApiBase :: PARAM_MIN => 1, |
| 106 | + ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1, |
| 107 | + ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2 |
| 108 | + ), |
| 109 | + 'continue' => null, |
| 110 | + ); |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * (non-PHPdoc) |
| 115 | + * @see includes/api/ApiBase#getParamDescription() |
| 116 | + */ |
| 117 | + public function getParamDescription() { |
| 118 | + return array ( |
| 119 | + 'props' => 'Translation memory properties to query', |
| 120 | + 'ids' => 'Limit the results to translation memories with an ID in this list', |
| 121 | + 'continue' => 'Offset number from where to continue the query', |
| 122 | + 'limit' => 'Max amount of words to return', |
| 123 | + ); |
| 124 | + } |
| 125 | + |
| 126 | + /** |
| 127 | + * (non-PHPdoc) |
| 128 | + * @see includes/api/ApiBase#getDescription() |
| 129 | + */ |
| 130 | + public function getDescription() { |
| 131 | + return 'This module returns all matching translation memories'; |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * (non-PHPdoc) |
| 136 | + * @see includes/api/ApiBase#getPossibleErrors() |
| 137 | + */ |
| 138 | + public function getPossibleErrors() { |
| 139 | + return array_merge( parent::getPossibleErrors(), array( |
| 140 | + ) ); |
| 141 | + } |
| 142 | + |
| 143 | + /** |
| 144 | + * (non-PHPdoc) |
| 145 | + * @see includes/api/ApiBase#getExamples() |
| 146 | + */ |
| 147 | + protected function getExamples() { |
| 148 | + return array ( |
| 149 | + 'api.php?action=query&list=translationmemories', |
| 150 | + ); |
| 151 | + } |
| 152 | + |
| 153 | + public function getVersion() { |
| 154 | + return __CLASS__ . ': $Id$'; |
| 155 | + } |
| 156 | + |
| 157 | +} |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/api/ApiQueryTranslationMemories.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 158 | + Id |
Added: svn:eol-style |
2 | 159 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/api/ApiImportTranslationMemories.php |
— | — | @@ -0,0 +1,202 @@ |
| 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 | + 'memory_version_hash' => uniqid(), |
| 137 | + ), |
| 138 | + array( 'memory_id' => $memoryId ) |
| 139 | + ); |
| 140 | + |
| 141 | + $dbw->commit(); |
| 142 | + } |
| 143 | + |
| 144 | + /** |
| 145 | + * Cleans the language code. |
| 146 | + * |
| 147 | + * @since 0.4 |
| 148 | + * |
| 149 | + * @param string language |
| 150 | + * |
| 151 | + * @return string |
| 152 | + */ |
| 153 | + protected function cleanLanguage( $language ) { |
| 154 | + $language = strtolower( $language ); |
| 155 | + $mappings = LiveTranslateFunctions::getInputLangMapping(); |
| 156 | + |
| 157 | + if ( array_key_exists( $language, $mappings ) ) { |
| 158 | + $language = $mappings[$language]; |
| 159 | + } |
| 160 | + |
| 161 | + return $language; |
| 162 | + } |
| 163 | + |
| 164 | + public function getAllowedParams() { |
| 165 | + return array( |
| 166 | + 'source' => array( |
| 167 | + ApiBase::PARAM_TYPE => 'string', |
| 168 | + ApiBase::PARAM_ISMULTI => true, |
| 169 | + //ApiBase::PARAM_REQUIRED => true, |
| 170 | + ), |
| 171 | + ); |
| 172 | + } |
| 173 | + |
| 174 | + public function getParamDescription() { |
| 175 | + return array( |
| 176 | + 'source' => 'Location of the translation memory. Multiple sources can be provided using the | delimiter.', |
| 177 | + ); |
| 178 | + } |
| 179 | + |
| 180 | + public function getDescription() { |
| 181 | + return array( |
| 182 | + 'Imports one or more translation memories.' |
| 183 | + ); |
| 184 | + } |
| 185 | + |
| 186 | + public function getPossibleErrors() { |
| 187 | + return array_merge( parent::getPossibleErrors(), array( |
| 188 | + array( 'missingparam', 'source' ), |
| 189 | + ) ); |
| 190 | + } |
| 191 | + |
| 192 | + protected function getExamples() { |
| 193 | + return array( |
| 194 | + 'api.php?action=importtms&source=http://localhost/tmx.xml', |
| 195 | + 'api.php?action=importtms&source=http://localhost/tmx.xml|http://localhost/google.csv|Live Translate Dictionary', |
| 196 | + ); |
| 197 | + } |
| 198 | + |
| 199 | + public function getVersion() { |
| 200 | + return __CLASS__ . ': $Id$'; |
| 201 | + } |
| 202 | + |
| 203 | +} |
\ No newline at end of file |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1/api/ApiImportTranslationMemories.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 204 | + Id |
Added: svn:eol-style |
2 | 205 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/api/ApiLiveTranslate.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 140 | + Id |
Added: svn:eol-style |
2 | 141 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_1/LiveTranslate.sql |
— | — | @@ -0,0 +1,25 @@ |
| 2 | +-- MySQL version of the database schema for the Live Translate extension. |
| 3 | +-- Licence: GNU GPL v3+ |
| 4 | +-- Author: Jeroen De Dauw < jeroendedauw@gmail.com > |
| 5 | + |
| 6 | +-- Special translations table. |
| 7 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/live_translate ( |
| 8 | + word_id INT(8) unsigned NOT NULL, |
| 9 | + word_language VARCHAR(255) NOT NULL, |
| 10 | + word_translation VARCHAR(255) NOT NULL, |
| 11 | + word_primary INT(1) unsigned NOT NULL, |
| 12 | + memory_id INT(4) unsigned NOT NULL |
| 13 | +) /*$wgDBTableOptions*/; |
| 14 | + |
| 15 | +-- Table to keep track of translation memories for the special words. |
| 16 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/live_translate_memories ( |
| 17 | + memory_id INT(4) unsigned NOT NULL auto_increment PRIMARY KEY, |
| 18 | + memory_type INT(2) unsigned NOT NULL, |
| 19 | + memory_location VARCHAR(255) NOT NULL, |
| 20 | + memory_local INT(1) unsigned NOT NULL, |
| 21 | + memory_lang_count INT(2) unsigned NOT NULL, |
| 22 | + memory_tu_count INT(8) unsigned NOT NULL, |
| 23 | + memory_version_hash VARCHAR(255) NOT NULL default '...' |
| 24 | +) /*$wgDBTableOptions*/; |
| 25 | + |
| 26 | +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_2_1/LiveTranslate.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 27 | + native |
Index: tags/extensions/LiveTranslate/REL_1_2_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_2_1/README |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 49 | + native |
Property changes on: tags/extensions/LiveTranslate/REL_1_2_1 |
___________________________________________________________________ |
Added: svn:ignore |
2 | 50 | + .git |
.gitignore |