[RESOLVED] Some problems with TinyMCE

[RESOLVED] Some problems with TinyMCE

Postby hELLO wORLD on Sun Jun 03, 2007 10:13 pm

Hi,

I have noticed that even if the TinyMCE plog is set to some locale with all things well done (French in my case), some functions are still in English.

It is because the included TinyMCE plugins are not localized (and sometimes not localizable !).

I have issued this on the Mantis bug reporting system, and since I have resolved the problem, I share the solution with you:

Here is a small tutorial on how to localize your TinyMCE in LT:

The first thing to do is to download the localization package (of your choice) from TinyMCE website and install files that are in the archive (files to put in the langs folders of various TinyMCE folders).

Then you have to change the /js/tinymce/tiny_mce-plog.js file and add this line:
Code: Select all
language : "fr",

somewhere before the 'valid_elements' line.
Note that you will have to change the 'fr' by the locale you wants to use (and you have just downloaded and intalled).

Thats great and it works, but the custom made plugins made by LT are still not localized. I have modified these files to made them localizable, and I have also made the French localization.
You can download theses files from the LT Mantis Bug Report System website. If you are not registered, you will have to, but it is easy.
Do some searches with my username 'hELLO wORLD' or with the 'locale' or 'localization' keywords and you should find my issues with my uploads.

My uploads are:
– insertvideo.zip
– insertresource.zip
– more.zip

Note that I have also made a plugin to play MP3 from external sites (or any URL) using the new embedded Flash MP3 Player included since the 1.2.2 LT version.
The plugin can be downloaded here
Please note you will have to declare the plugin to TinyMCE by editing the '/js/tinymce/tiny_mce-plog.js' file.
In this file, you have to declare the plugin in the 'plugins' line by adding 'insertaudio':
Code: Select all
plugins : "fullscreen,table,inlinepopups,insertdatetime,emotions,insertresource,insertvideo,insertaudio,more",

And you also have to tell TinyMCE where to put the button by adding 'insertaudio' in the buttons, for exemple in this line:
Code: Select all
theme_advanced_buttons2 : "bullist,numlist,indent,outdent,separator,link,unlink,image,insertresource,insertvideo,insertaudio,emotions,separator,hr,insertdate,inserttime,separator,fullscreen,separator,code,more",


Note also that there is an issue in the Bug Reports to have TinyMCE to automatically use the right localization from your locale preference (the one you set in LifeType from Admin.php). So in the future, we should see this nice behavior in place :-)
Last edited by hELLO wORLD on Mon Jun 04, 2007 1:45 pm, edited 2 times in total.
hELLO wORLD
 
Posts: 22
Joined: Mon Jan 29, 2007 9:04 pm

Postby phunkphorce on Mon Jun 04, 2007 2:25 am

The problem with localizing TinyMCE is that not all languages that are available in LT are available in TinyMCE. And sometimes those that are available in TinyMCE, are using a different encoding than in LT so we would need to do a lot of additional work with every release of TinyMCE in case we wanted to keep the translations in sync. So the easiest route for us was not to localize it...
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby jondaley on Mon Jun 04, 2007 7:26 am

I added your code to 1.2.3.

Thanks for the code.

In the future, if you could upload just the files that you changed, that makes it simpler for me to apply your patches.

Also, the .DS_Store and __MACOS stuff shouldn't be included either.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby hELLO wORLD on Mon Jun 04, 2007 8:32 am

jondaley wrote:I added your code to 1.2.3.

Thanks for the code.

In the future, if you could upload just the files that you changed, that makes it simpler for me to apply your patches.


Also, the .DS_Store and __MACOS stuff shouldn't be included either.


Ok.

Sorry for the Mac OS files ! My last upload (the insertaudio plugin v3) have them again :-/
I will check that next time.
hELLO wORLD
 
Posts: 22
Joined: Mon Jan 29, 2007 9:04 pm

Postby hELLO wORLD on Mon Jun 04, 2007 8:42 am

phunkphorce wrote:The problem with localizing TinyMCE is that not all languages that are available in LT are available in TinyMCE. And sometimes those that are available in TinyMCE, are using a different encoding than in LT so we would need to do a lot of additional work with every release of TinyMCE in case we wanted to keep the translations in sync. So the easiest route for us was not to localize it...


I see the problem…

Maybe you could support languages that are using the same encodings (with a README note to inform people about the problem), and maybe some volunteers would like to work on this. After all, I have done this work because I like LifeType and I wanted it in French.

But please, even if you dont support TinyMCE localization, take care to make your plugins localizable using 'langs' folder and
Code: Select all
tinyMCE.getLang()
and
Code: Select all
{$lang_template_string}

This permits other people to localize them more easily if they want.
hELLO wORLD
 
Posts: 22
Joined: Mon Jan 29, 2007 9:04 pm

Postby jondaley on Mon Jun 04, 2007 12:57 pm

I asked this on the development list, but no one has answered yet - do you know what happens in tinymce when a language isn't available:
Code: Select all
tinyMCE.importPluginLanguagePack('insertvideo', 'en,fr');

or what happens if there is an element on that list that then doesn't exist?

I see that you didn't add the importPluginLanguagePack line to the more plugin - I don't know tinymce well enough to know if that is needed? I assume your french locale file is working.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby hELLO wORLD on Mon Jun 04, 2007 1:14 pm

jondaley wrote:I asked this on the development list, but no one has answered yet - do you know what happens in tinymce when a language isn't available:
Code: Select all
tinyMCE.importPluginLanguagePack('insertvideo', 'en,fr');

or what happens if there is an element on that list that then doesn't exist?

I don't know what happens in theses cases… I will try to see by setting TinyMCE plog to a third language not supported by the plugin.


jondaley wrote:I see that you didn't add the importPluginLanguagePack line to the more plugin - I don't know tinymce well enough to know if that is needed? I assume your french locale file is working.

Yes, it is working. I don't know about this setting. I will add it to be sure.
I am not a TinyMCE expert too, but I have parsed their wiki documentation API and you code.
hELLO wORLD
 
Posts: 22
Joined: Mon Jan 29, 2007 9:04 pm

Postby phunkphorce on Mon Jun 04, 2007 5:11 pm

An additional problem with this is that if you set TinyMCE to use a language that is not 100% available, so that even if only one plugin does not provide this language, tinymce_gzip.php will display an error (depending on your PHP error reporting settings, this error might be logged to the Apache error_log file) and therefore no Javascript code will be loaded.

Now if we want to get rid of this message and provide proper TinyMCE location, we'll need to modify at least this one TinyMCE core file to make it not spit out errors, which is annoying.

You should remember this in case TinyMCE one day stops working, in case you decide to add some random TinyMCE plugins...
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby hELLO wORLD on Mon Jun 04, 2007 5:22 pm

hELLO wORLD wrote:
jondaley wrote:I asked this on the development list, but no one has answered yet - do you know what happens in tinymce when a language isn't available:
Code: Select all
tinyMCE.importPluginLanguagePack('insertvideo', 'en,fr');

or what happens if there is an element on that list that then doesn't exist?

I don't know what happens in theses cases… I will try to see by setting TinyMCE plog to a third language not supported by the plugin.

I have tried to set TinyMCE to use 'de' since I have not installed the deutsh TinyMCE locales nor my plugin support deutsh.

The result is that every localized strings shows litteraly as {$lang_theme_string} or {$lang_string}. So users should be sure to have all TinyMCE locales installed if they want to use some other language.
That's not good news of course, and maybe we can contact the TinyMCE developers to at least use the English locale when the locale is not present in some plugin or core function.
I understand here that it is not your job anymore to fix this problem, but it would be great if the TinyMCE team heard us… I will send them a message with a link to this forum.

Anyway, thanks for your support, and please, keep your plugins easily localizable for people who want to try…
hELLO wORLD
 
Posts: 22
Joined: Mon Jan 29, 2007 9:04 pm

Postby hELLO wORLD on Mon Jun 04, 2007 5:26 pm

phunkphorce wrote:An additional problem with this is that if you set TinyMCE to use a language that is not 100% available, so that even if only one plugin does not provide this language, tinymce_gzip.php will display an error (depending on your PHP error reporting settings, this error might be logged to the Apache error_log file) and therefore no Javascript code will be loaded.

Now if we want to get rid of this message and provide proper TinyMCE location, we'll need to modify at least this one TinyMCE core file to make it not spit out errors, which is annoying.

You should remember this in case TinyMCE one day stops working, in case you decide to add some random TinyMCE plugins...


Another problem. I will also point this to the TinyMCE team.
hELLO wORLD
 
Posts: 22
Joined: Mon Jan 29, 2007 9:04 pm

Postby hELLO wORLD on Mon Jun 04, 2007 6:08 pm

Done. I have sent a new issue in their bug reporting system.
It is really not easy to get support from them ! No forum, only bug tracking and paid support ( $25 per question ! )

Congratulations for your reactivity and the easy ways to contact you and participate to your great project !
hELLO wORLD
 
Posts: 22
Joined: Mon Jan 29, 2007 9:04 pm

Postby phunkphorce on Tue Jun 05, 2007 2:22 am

In this case the issue should be easy to fix, it's just a matter of adding some checks in tinymce_gzip.php to make sure that a language file exists and if it doesn't, then fall back to en.js. But it's still annoying that those guys haven't thought about it...
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa


Return to Localization

cron