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:

menu strings

database fields translations (we can use some general function that will be used to translate column name from database to string, even english version can benefit from it)

dates and periods (e.g. in Home module)

plugin descriptions (cannot be translated now, because loading translation files for plugins use the function that returns description)

All strings that include number, ie. “13 visitors yesterday” should appear as “%s visitors yesterday” in the config file.
Currently:
```
{$nbVisitors} {’General_yesterday’|translate}
```
Should be
```
{’General_yesterday’|translate:$nbVisitors}
```
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
```
$format = ‘The %2$s contains %1$d monkeys’;
```
Because in different languages numbers orders can be swapped in the sentence.

I’ve noticed that in rare cases the coding standard is not followed, for example in getJsTranslation()

there is no comment at the function

the
```

if( !$moduleList )
return ’’;
```
should be
```

if( !$moduleList )
{
return ’’;
}
```

your idea of the _ javascript function seems good to me. However this name is not good as there will be conflicts with other javascript codes. Think that piwik HTML and JS code will be very often included within other CMS / blogs / etc. so we should make sure the function/class names don’t conflict with other names. How can we handle this problem?

I can’t see in the code where you use the smarty variable $moduleTranslations built in the loadTranslation(); havent you forgotten to add the new smarty filter you created?

this loadTranslation() function could have a better name like loadJavascriptTranslation() or something else?

maybe the call to loadTranslation() could be automatic in some ways? For example instead of assigning a smarty variable, maybe we could call a smarty function from the template that would load the _js prefixed strings? Other idea?

anyway this is good work in progress :) i hope this review is useful.
good luck!

`()` function was renamed to `_pktranslate()`, if there are more general functions I think it will be good to make a javascript namespace with all of them, i.e. i think we need sprintf function for some of javascript translations… and there will be certainly more of them

coding standards are now followed more strictly, but feel free to find those places where it is not :)

I added translation files which I forgot to `svn add`. There is quite a lot of small files to translate now, and I think it can be good to put all ‘standard’ plugins’ translation strings into one file to make translators’ work easier…

ps. I couldn’t find any translation that was done without format strings, but maybe I missed sth?

+{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}
should be
<span>{’VisitsSummary_NbUniqueVisitors’|translate:“<strong>”.$nbUniqVisitors.“</strong>”}

btw there shouldn’t be HTML in translations, except for the <br>

your concept of _pk_translate seems quite good, because it makes it easy when there are no translations.

the commenting on the smarty plugin could include an example of usage it would be more easy to understand

good job so far. we have to think also about how to make it easy for other people to translate piwik, we need a script that reads all the strings in all plugins, requests user translations in a nice HTML form, saves files in the given plugins. What do you think about it? We can have a look at how Facebook translations work.

PS: sorry for the delay now I should be able to review future code much faster :)

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

make it easy to translate all strings in one page

generate the plugin translation files automatically ; or no generation if there is no string provided ; doesn’t generate the non translated strings in the files (it will defaut to english strings anyway)

for exception there is no point trying to translate the few exceptions that would occur before the translations files are loaded. Everything after the call to```
Piwik::loadPlugins()``` (line 305 in /trunk/modules/FrontController.php) can be translated, but the few exceptions before this line cannot. I would suggest to go for Exception(‘Message in english’) and Exception(‘IndexTranslation’) : both of them would work. ie, if the dev doesnt care about translations, it’s ok it stays the same simple syntax. If he cares, then he puts in an index and he has to add the entry in the english language file. The class name would be```
Piwik_Exception```

the problem in the current architecture I can see is that we have to duplicate the JS strings, which is annoying. Is there any other solution you can think of?

other than that your changes are good :)

can you think of other things to be done in order to have a proper i18n support? I can think of

Message translation cannot be done in Piwik_Exception class, because getMessage() method is not overridable. I will check for translations in Piwik_ExceptionHandler.

2. Javascript strings duplication.

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.

3. Column labels.

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 :)

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.

I can see a problem for the current javascript strings. The fact that the strings are duplicated is not reliable. Above #5482 I think that to load by default the english string is a good idea.
```
string = pk_translate(’HomeIncludeAllPopulation’);```
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…

I am still not sure about how to do the menu translation

I suggest we don’t translate plugins descriptions. I have never seen a software that translates the plugin descriptions. I think this is not really useful.

graph label translations: do not handle it at the moment, as the whole graph labelling architecture is not here yet, the labelling is often wrong (always nb_visit). We will address this problem later.

great job! this is not easy and requires hard and cautious work, this is an amazing new feature to piwik…