Skip to main content
Topic: Special characters in Editor language file (Read 2261 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Special characters in Editor language file

Hey,

I have noticed any "special" character you insert into the Editor language file does not parse properly even if the file is indeed UTF8.

I am talking mainly about the hover tooltips for example danish language makes use of the chars "æ, ø, å" but it does not show up correctly. I assume other languages have similar things.

Re: Special characters in Editor language file

Reply #1
I assume other languages have similar things.

The german ä, ü and ö are displayed in the tooltips, but I have another problem:

There is no string for "description (optional)" in Editor.english.php, so I cannot translate it and this text for inserting a link is displayed in english. There are only very simular strings for inserting images in the language files.

X X

Maybe something has to be changed in GenericControls.template.php?

For example this line there is showing an 'en_US'

Code: [Select]
locale: "', !empty($editor_context['locale']) ? $editor_context['locale'] : 'en_US', '",

I cannot find "locale" in the language files, just for example this string: $txt['lang_locale'] = 'de_DE.utf8';

So maybe 'en_US' has to be replaced with 'de_DE.utf8' in GenericControls.template.php?

Re: Special characters in Editor language file

Reply #2

The german ä, ü and ö are displayed in the tooltips, but I have another problem:

Strange. My locale is set to da_DK.utf8 and it displays the "æ, ø, å" characters just fine everywhere else, only the tooltips on the editor it fails. Probably something to do with the fact its a javascript.

For example this line there is showing an 'en_US'

Code: [Select]
locale: "', !empty($editor_context['locale']) ? $editor_context['locale'] : 'en_US', '",

I cannot find "locale" in the language files, just for example this string: $txt['lang_locale'] = 'de_DE.utf8';

So maybe 'en_US' has to be replaced with 'de_DE.utf8' in GenericControls.template.php?

The locale is defined in index.english.php line 11 ($txt['lang_locale']), also the code you posted, en_US is the fallback if no other locale is defined, it does set it to the defined locale first (if available)

The reason it has a different name is because the $editor_context is pulled from another array where it will use the lang_locale to set the locale, specifically $context['controls']['richedit'][]

As for your question, the Description (optional) string is hardcoded into default\scripts\jquery.sceditor.bbcode.min.js should be moved into $txt

Re: Special characters in Editor language file

Reply #3
hmm... interesting.

As for your question, the Description (optional) string is hardcoded into default\scripts\jquery.sceditor.bbcode.min.js should be moved into $txt
This is a string missing in the translation. Nice catch.
Actually I think it would be better to have a review, I feel like few strings were added, but not updated properly (not even by Sam I feel).

Regarding the problem at hands, is it happening here at elk-net, or at your website?
If at your site, could you try to set Danish here? (I think it is available, if it is not let me know I can add it.)
Bugs creator.
Features destroyer.
Template killer.

Re: Special characters in Editor language file

Reply #4
Regarding the problem at hands, is it happening here at elk-net, or at your website?
If at your site, could you try to set Danish here? (I think it is available, if it is not let me know I can add it.)

Funny, i didn't even think about trying that :) As it happens it shows correctly here at elk-net when i set my language to danish but not on my own server for some reason. Interesting.

Edit: So i tried changing the encoding of the Editor.danish.php language file from utf8 to ascii and now it shows correctly, if i change it back to utf8 it shows garbled text again for these special chars. Very interesting, should be the other way around if it is not utf8, but who knows. Only the Editor language file is affected, the rest of the language files are in utf8 and shows up correctly.

Re: Special characters in Editor language file

Reply #5
hmm... pretty interesting. I love characters encoding! xD
I assume the browser is the same.
Also, I'm assuming you are talking about 1.1 (even though it shouldn't make any difference... in theory).

Are you using minification on js files?
Can you check if by chance the server is sending some wrong information about the charset for js files?
Bugs creator.
Features destroyer.
Template killer.

Re: Special characters in Editor language file

Reply #6
hmm... pretty interesting. I love characters encoding! xD
I assume the browser is the same.
Also, I'm assuming you are talking about 1.1 (even though it shouldn't make any difference... in theory).

Are you using minification on js files?
Can you check if by chance the server is sending some wrong information about the charset for js files?

Yeah i'm on 1.1.3, same browser and no minification. Everything is sent as utf8. I did notice basically 95% of all .js files are not in utf8 though but i tried changing the encoding and it did nothing at all, they are also sent gzipped to the browser.

Request URL: jquery.sceditor.bbcode.min.js?R113
Request method: GET
Request headers (1.127 KB)
Accept */*
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection keep-alive

Re: Special characters in Editor language file

Reply #7
Could you please zip the file Editor.danish.php (I think it is "danish" but I'm not sure lol, well, anyway the Editor file in Danish) and attach it here?
Bugs creator.
Features destroyer.
Template killer.

Re: Special characters in Editor language file

Reply #8
Sure, is the same one as on transifex.

There is nothing wrong with the language file, if i put in some debugging and output some of the strings directly on the page it all shows correctly, the problem only occurs through the editor js.


Re: Special characters in Editor language file

Reply #9
Why did you attach two?
Which one is the one you are using?
Bugs creator.
Features destroyer.
Template killer.

Re: Special characters in Editor language file

Reply #10
As i said above changing the encoding from utf8 to ascii fixed the issue (for whatever reason) that's why i included both. I'm currently using the ascii one so the problem is solved, the utf8 is the original which causes the issue.

Re: Special characters in Editor language file

Reply #11
The file here was outdated, and was still in English... lol

Anyway I updated it few moments ago with your UTF8 file, so if you want to give it another try it would help.
With my browser it seems to work.
Bugs creator.
Features destroyer.
Template killer.

Re: Special characters in Editor language file

Reply #12
Yeah it works fine. I'm not entirely sure what the difference is on my server that makes it go haywire when the file is in UTF8 but i can live with it being in ascii, at least it works then.

And the danish language pack you are using on the site currently is ancient, i have completed the translation on transifix a long time ago for both 1.0.x and 1.1.x.

Re: Special characters in Editor language file

Reply #13
Yep, actually I thought they were automatically updated from time to time but I was wrong. O:-)
I'll upload the new versions next week. :)
Bugs creator.
Features destroyer.
Template killer.