New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making piwik translation ready #5482
Comments
Translate also |
(In 390) – fix #5563 |
Javascripts translations can be done by renaming [to [filename](filename].js)_js.tpl and putting in those smarty templates translations strings (I can include this change in my template translation patch which is nearly done). Theres are problems with: |
Submitted patch introduces translation strings in templates. Some things to discusss: |
Attachment: Merged changes with current (409) revision |
Attachment: i18n.patch + some example approach for JS translation (see more in comment) |
Javascript translations. If you use text strings in your plugin: 1) put in Controller: 2) whenever you use string make it translate-friendly: ``` you can also use some popular translations from ‘General’ module: (’GeneralBack’,‘back’) 3) in php translation files define your variable keys as: ``` so the translation team will know which strings should be translated Example of working code is in SitesManager plugin. |
quick remarks: ``` Should be ``` ie. we give the value to be replaced as an argument of the smarty filter. NB: When there are more than one value to be sprintf (should be very rare) we should number the %s, ie ``` Because in different languages numbers orders can be swapped in the sentence. ``` if( !$moduleList ) return ’’;``` should be ``` if( !$moduleList ) { return ’’; }``` anyway this is good work in progress :) i hope this review is useful. |
Attachment: new version of i18n patch with javascript translation functions |
I made several modifications, ``` ps. I couldn’t find any translation that was done without format strings, but maybe I missed sth? |
Attachment: current i18n patch (compatible with rev 424) |
- +{literal}Last modification time, description and reporter are included as hidden fields for useful RSS export. why this add?- <span><strong>{$nbUniqVisitors}</strong> {’VisitsSummary_NbUniqueVisitors’|translate} |
Attachment: compatible with rev 432 |
New patch: PS. somehow you managed to break trac html filter (everything in bold now) ;> |
it seems you haven’t added the right patch (the patch is still the same). whats needs to be done in order to have a working i18n version of piwik? we have to think of the Plugin that we have to write to make it easy to translate piwik, through a simple web interface that would |
NB: we have to make sure that all exceptions thrown before the language files are loaded are ONLY thrown in ENGLISH and that the text is hardcoded in the source files. —> how to make sure all these exceptions are hardcoded? |
Attachment: right patch |
- I suggest creating seperate ticket for the translation plugin ``` PS. I attached the right patch :) |
‘’’ \* agree, please create a new ticket with your specification |
Just several quick comments and issues to discuss. Message translation cannot be done in Piwik_Exception class, because getMessage() method is not overridable. I will check for translations in Piwik_ExceptionHandler. We certainly need definitions in translation files, so the only way is not to put default string in js code, and by default load english strings. I haven’t understood all of datatables code yet, but we can call _pk_translate() in javascripts on column labels (and somewhere store original labels to keep working sort functions etc.). The same applies to other chart labels, but I need some help with it in order not to waste much time on it :) |
Attachment: TranslateException, translation strings for exceptions in plugins/ |
- new function Piwik_TranslateException used to translate exception messages – neither overriden class nor translation in Piwik_Exception (log/Exception etc.) can be done, because than we cannot use sprintf for translations with parameters. TODO: |
Attachment: solves also #65 and #116 |
Some quick remarks on last patch: |
Idea for columns translations interface: in Controller.php add ``` or maybe even better assigning translated string: ``` Then change modules/ViewDataTable so they pass translated strings values to templates (if translation does exist, in other case translated string = column name). And change templates so instead of column names display translated labels. I tried to find a place where it can break widgets (e.g. sorting, paging) but didn’t find anything… maybe I haven’t noticed sth? |
Attachment: |
- added column translations |
Attachment: |
CHANGES: TODO: |
Attachment: |
Changes: TODO: |
(In [[mauser](447]))- refs #5482 commited huge work by Maciej Zawadzi?\197?\132ski: thanks! still some work to do + QA but looks really good :) |
feedback on the submitted patch ``
would be better than the current `````` string = pk_translate(’HomeIncludeAllPopulation’,‘Include all population’);``` And if the dev doesn’t care about translations he would simply use hardcoded strings in his JS files… |
Status of german translation is nearly 80%. (i would note it here, so that nobody else started to translate) :) |
Attachment: _pk_translation without default strings, fix in Visitors→Overview view |
small patch |
German languages files for avaiable plugins attached – pls integrate into svn. |
Attachment: german language files |
Attachment: fixes #62, #65, #116 and adds german translations |
(In [[mauser](454])) – fixes #5536, font consistent, escape key now works |
We must add the information of the translators in the main translation files. |
Support for right-to-left languages: |
- Example of a custom RTL CSS |
Please, let’s leave this ticket, the first part of the plan has been implemented. |
There is still work to make piwik fully translatable.
We have to all strings
- in templates
- in JS variables
- design a generic system for the php exceptions to handle multilingual error messages
Keywords: i18n translation translate internationalization
The text was updated successfully, but these errors were encountered: