Ajax language problem
There is an annoying problem: when you have a blog in another language than English, WPForo will load the MO files to search for translations of the UI texts (in both the front and back end). Unfortunately, it will keep using the `wp_wpforo_phrases` table for the Ajax localization... and because, by default, there is just one language ("English"), it will uses the English texts. I don't know if it's a bug or a known problem.
When a MO file is loaded, it should either be used to populate the `wp_wpforo_phrases` table or, at least, be used to localize the Ajax scripts.
I had to convert the MO file to an XML one and import it in order for the Ajax texts to be in the same language as my WordPress setup.
This forum is great but there is some work to do on the translation system...
Please note, that wpForo phrases system is only designed for front-end quick translation. This is not a full translation system. All phrases are connected to MO file, but first it checks in wpForo Phrase table, if there is no translation it gets the phrase from MO file. This is the logic of wpForo translation.
AJAX should also work based on the same logic, if you ave all translation phrases in MO file it'll work for AJAX too. If you only use Phrases you should make sure the phrase exists in Phrase system, because the phrase system only contains front-end phrases. You should click on Add new button and add the phrase you want.
However if you have a multi language site we don't recommend phrase system, it's easy to translate with PO /MO files.
I confirm that it's not working as expected. To reproduce :
- Install WordPress in French
- Install WPForo
Then, browse to a WPForo page: the visible UI texts is in French (the translation is bad and incomplete) but use the wpforo-fr_FR.po PO file included with the plugin.
BUT, view the page source and search for "var wpforo_phrases"... this object (used for the translation of texts in JS code) only contains English sentences with English translations. It doesn't use the translations from the PO file. You can esaily see that "%s and %s liked" is not translated whereas it should be "%s et %s aiment" (you can look at the bundled wpforo-fr_FR.po file).
To have this JS object containing the French translations, I need to create an XML file with the French sentences and import it using the phrases system and use it as default WPForo language.
Maybe, when WPForo is installed on a WordPress in a language different than English and your plugin bundles a PO file for this language, your plugin should automaticaly add this language to the phrases system.
Or, you can find a way (correct the bug?) to generate this array using the translation from the PO file.
Ok, thank you tristanleboss,
AJAX only gets translation phrases included in Phrase system. If there is no some phrase in Phrase system the translation will not work for AJAX actions, even though the PO file is fully translated. Am I right? We're going to check and fix this issue too.
The problem is that on a non-English WP version, your phrases system only contains the "English" language which is a non-translated one. Your AJAX system will get the phrases from this only language...
In the settings, there should be a button "Create a new language in the phrase system using the currently loaded PO file". This action should be started during the activation of the plugin if the WP language is not English.
Because nowadays, I had to create an XML file from the PO file in order to add the translations to your phrases system. This is far from ideal.
For exemple, on my French WP, when I activate WPForo it should create the English language (like it already does) but also create the French language using the PO files which is automaticaly loaded by WordPress because you bundle it with the plugin. This way, I should end up with 2 languages in the dropdown: English and French; with French being selected as the default WPForo language. This way the AJAX system will pull the translation from it.