espresto / reclaim-social-media

reclaim your stuff from social media silos
GNU General Public License v2.0
47 stars 10 forks source link

mod.class.php : "remove x posts" no translation #121

Closed danito closed 10 years ago

danito commented 10 years ago

Can you check line 41? Translation aren't shown (for fr_FR) for the Remove x posts (ajax) button; I uploaded my latest fr_FR.po file, all the rest seems ok .

danito commented 10 years ago

line 386 same problem .translate() in place of echo sprintf(__()); This seems not to work with po files.

danito commented 10 years ago

the Remove x posts remains in en. Do you have it translated in de?

diplix commented 10 years ago

works for me: https://dl.dropboxusercontent.com/u/9898000/Bildschirmfoto%202014-02-20%20um%2023.34.09.png also changed translate() to __(): https://github.com/espresto/reclaim-social-media/blob/master/mod.class.php#L386

diplix commented 10 years ago

we found no way to translate the ajax strings, those that are not created with php but javascript.

danito commented 10 years ago

for the buttons: ok, didn't push the latest version. We can close this. For the JS translation : this will make the adminajax.js less readable, but what about a translations.php

$translation['countitems'] = sprintf(__("count items",'reclaim'));
$translation['itemcountisnotavalid']= sprintf(__('item count is not a valid number','reclaim'));
....
echo json_encode($translation);
}

and for the admin_ajax.js

var translationstrings = {};
function getTranslation(){
$.getJSON('translation.php', function(data){
...
translationstrings = data;
....
    else {
this.ajax_start(translationstrings.countitems);

this.ajax(getTranslationstrings.itemcountisnotavalid, {}, $.proxy(function(result) {
this.ajax_end(result);
}, this));
}
});
}

The ajax call should maybe be synchronous. But I think you get the idea, to put all the ajax text to display in a php file and get it as json.

diplix commented 10 years ago

ajax localisation added with the help of wp_localize_script() https://github.com/espresto/reclaim-social-media/commit/4a52a0f43dec3848be78c67a98c302474bcc33d0