تووڵ تڕانسلەیت
ئەمە ڕێنوێنینامەی ئامرازی تووڵ تڕانسلەیتە. ئەگەر ویستت وەریبگێڕە!
مەبەست
زۆرێک لە ئامرازەکانی سەر تووڵفۆڕج وەرگێڕانی ڕووکارییان نییە، واتە تەنھا بە یەک زمان بەردەستن، بەزۆری بە ئینگلیزی. تەنانەت ئەو ئامرازانەی کە پشتگیریی چەندین زمان دەکەن لە ڕووکارەکەیاندا، ڕێگەی چەقبەستوو بەکاردەھێنن بۆ زیادکردنی زمان و وەرگێڕانی نوێ. تووڵ تڕانسلەیت ڕێگەیەکی ناوەندی و بەکارھێنەردۆستانە پێشکەش دەکات بۆ کۆمەڵگە (TM) بۆ دابینکردنی وەرگێڕان بۆ ئامرازەکان. ئامرازەکان پێویستە پشتگیریی ئەم شێوازە بکەن، واتە پێویستە جارێک کاریان لەسەر بکرێتەوە بۆ بەکارھێنانی دەقی بزۆک لەجیاتیی دەقی وەستاو لە ڕووکارەکەیاندا. پۆستی بڵۆگی ڕەسەن.
وەرگێڕان
- Go to the tool
- If requested, authorize the tool
- Chose a tool to translate from the drop-down box at top or list on main page
- Chose or add the language to translate into
- Double-click the "cell" where your new translation should go, or the translation you wish to improve
- Type in your text. You can use HTML (no JavaScript!). There may be a suggestion for translation from another tool with the same "key name", you can use it as a basis for your text.
- Click OK. Done! Browser caching issues aside, your translation should show in the respective tool the next time you load it.
سەرچاوەکان
- Demo video on the ToolTranslate interface (used on the tool itself!)
- Simple demo tool and HTML/JS source
- WikiLovesMonuments (Wikidata edition) as a slightly more ambitious example
- git repo
تەکنەلۆژیا
Translations are stored in a database on Toolforge. Old revisions of translations are kept, and translations are attributed to the respective editor. (A "recent changes" tool is available.)
To simplify access to translation data, all translations are also stored in JSON files, which are updated on every change. Example "demotool1":
- toolinfo.json, a JSON file with information about the tool
- en.json, the JSON file containing the English translation of that tool. Other languages work in the same manner, with the respective language code
There is also a JSON file with all valid languages.
بنکەدراوە
The source data is stored in the s53069__tooltranslate_p
database on tools-db on Toolforge (mysql --defaults-file=~/replica.my.cnf -h tools-db s53069__tooltranslate_p
). Data can be fetched from there as well if needed.
Following tables are available:
- tool
- id | name | label | url | owner
- translation
- id | tool_id | language | key | json | user | timestamp | current
چۆنییەتی: ئێچ تی ئێم ئێڵ/جاڤاسکریپت
- Check out the demo code
- The ToolTranslate JS code has a list of options you can use
- If you want a translated string (using example object
tt
),tt.t(key)
ortt.t(key,{lang:language_code})
will get it for you - In HTML, add the
tt
attribute to any tag, e.g.<span tt='key'></span>
. - Translation strings containing "https://bitbucket.org/magnusmanske/tooltranslate/src/d93e2e706a76be21ee02affb0bc1cdece8f087ae/public_html/demos/demotool1.html?at=master&fileviewer=file-view-default" to "$9" will have those automatically substituted by tag attributes "tt1" to "tt9", respectively. This is to allow the change of interface language without splitting texts into many fragments. The translation will not be touched if the attributes are missing. In JavaScript,
tt.t(key,{params:['value for https://bitbucket.org/magnusmanske/tooltranslate/src/d93e2e706a76be21ee02affb0bc1cdece8f087ae/public_html/demos/demotool1.html?at=master&fileviewer=file-view-default','value for https://bitbucket.org/magnusmanske/tooltranslate/src/d93e2e706a76be21ee02affb0bc1cdece8f087ae/public_html/tt.js?at=master&fileviewer=file-view-default']})
.
چۆنییەتی: پی ئێچ پی
There is a PHP class that you can include on Toolforge, like so:
require_once ( "/data/project/tooltranslate/public_html/tt.php") ;
You can then instantiate the class:
$tt = new ToolTranslation ( array ( 'tool' => 'your_tool_key' , 'language' => 'de' , 'fallback' => 'en' , 'highlight_missing' => true ) ) ; // <span lang="en" dir="ltr" class="mw-content-ltr">Everything except 'tool' is optional</span>
بەکارھێنانی یەکسەری
There are two ways of getting interface translations in PHP. One is directly getting a translated string
print "<p>" . $tt->t('translation_key') . "</p>" ;
But this has the disadvantage that the translation cannot be changed without reloading the page.
بەکارھێنان لەڕێی جاڤاسکریپتەوە
You can instead add HTML "translation tags" (see above), and have the class add the necessary JS invocation. Another advantage is that the PHP class does not need to load any translation files if you never use the "direct" translation above. To use HTML/JS translation, the <head> section of your pages' HTML needs to contain
<script src="https://tools-static.wmflabs.org/tooltranslate/tt.js">
(You will also need jQuery.) When generating the page, instead of the above, write:
print "<p tt='translation_key'></p>" ;
Somewhere in the output (maybe towards the end), you will need to add the invocation code:
print $tt->getJS() ;
This will initialize the required JS, reproducing the parameters used in the PHP instance (fallback language etc.). If you want a "translation dropdown", add a wrapper element in your HTML code
<div id='tooltranslate_wrapper'></div>
then give the jQuery accessor as a parameter to the getJS method call:
print $tt->getJS('#tooltranslate_wrapper') ;
سەیری ئەم ئامرازە بکە بۆ نموونەیەکی کارا.