Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2005-03-16 06:54:36

pee_cee
New member
Registered: 2005-03-16
Posts: 5

i18n javascript error?

Hi

I had setup htmlarea3, which was ok, but then found xinha so i changed over to this for latest bug fixes etc.

i have changed my web page to point to xinha/htmlarea.js instead of htmlarea/htmlarea.js, and set the _editor_url correctly, but when the page loads i get a javascript error:

HTMLArea.I18N.tooltips is null or not an object.

line 721, which is:
el.title = HTMLArea.I18N.tooltips.textindicator;
i think.

Is there something i have not done correctly?

Offline

#2 2005-03-16 10:34:12

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?

mozilla or firefox?


Niko

Offline

#3 2005-03-16 10:36:35

pee_cee
New member
Registered: 2005-03-16
Posts: 5

Re: i18n javascript error?

ie6 actually

Offline

#4 2005-03-16 11:10:21

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?

ok, and how do you configure xinha, can you post the code you use?


Niko

Offline

#5 2005-03-17 05:58:31

guenole
New member
From: France
Registered: 2005-03-16
Posts: 6
Website

Re: i18n javascript error?

I have the same problem when i use _editor_lang = "fr";

Just put _editor_lang = "en"; resolve my problem...

Offline

#6 2005-03-19 01:34:08

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: i18n javascript error?

guenole wrote:

I have the same problem when i use _editor_lang = "fr";

Just put _editor_lang = "en"; resolve my problem...

Indeed, the translations will be out of date.  English is the only supported one at the moment.  Patches are welcome for the others.


James Sleeman

Offline

#7 2005-03-21 04:18:15

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?

do you have plans for the new i18n-system you talked about some time ago?
how will it work? did you start coding allready? do you need any help?


Niko

Offline

#8 2005-03-21 06:03:57

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: i18n javascript error?

I have plans in my head, and there is some code in the source.

If you have the time, js knowledge, some php/perl knowledge and a bit of inspiration, feel free to take it from where I left it, I don't know when I'll get a chance to get back to that area.

See htmlarea.js, search for "loadlang", and have a read of the _lc method below it.  Basically loadlang should return, for a given "context" an object containing the translations for a string

{ "Hello" : "Bonjour" }

Then the idea is that where translations are required you do

HTMLArea._lc('Hello', 'HelloWorld')

and it returns either a translated string for "Hello" in the "HelloWorld" context.

The context defaults to HTMLArea, and is intended to basically be either the default or the name of a plugin.

The central point of the plan is that I want to be able to use loadlang both with static javascript translation files like we have currently, but also be able to "target" it to a php backend using GNU gettext, or a CF backend using some special database, or a ..... you get the idea.

The bit that needs some thought now though is the *default* behaviour of loadlang, specifically, given a context, how should it figure out what static javascript file it's supposed to load (using _geturlcontent()).

You should also have a look at the Linker plugin, and particularly inline_dialog.js (in the root), this already uses the _lc function to get translations, although it will only ever return the untranslated strings currently.


James Sleeman

Offline

#9 2005-03-22 03:25:19

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?

current lang-file:
(lang/en.js)

HTMLArea.I18N = {
 lang: "en",
 tooltips: {
  bold:           "Bold",
  italic:         "Italic",
  underline:      "Underline",
  strikethrough:  "Strikethrough",
  subscript:      "Subscript",
  superscript:    "Superscript",
  justifyleft:    "Justify Left"
}

could be changed into:

{
  "Bold":           "Bold",
  "Italic":         "Italic",
  "Underline":      "Underline",
  "Strikethrough":  "Strikethrough",
  "Subscript":      "Subscript",
  "Superscript":    "Superscript",
  "Justify Left":    "Justify Left"
}

using the same filenames. (is this a good idea??)
the default-loadlang then calls getUrlContent with lang/en.js or plugins/context/lang/en.js

or a custom backend is defined (through config) where getUrlContent gets called with lcbackend.php?lang=en&context=HTMLArea


It would be possible to write a little script that converts the old files into the new ones - so we don't loose translations.


Niko

Offline

#10 2005-03-22 06:30:35

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: i18n javascript error?

Sounds fine to me.  Get coding smile


James Sleeman

Offline

#11 2005-03-22 06:35:28

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?

ok... i hope i will find some time big_smile


Niko

Offline

#12 2005-03-23 05:48:58

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: i18n javascript error?

Hi,

It seems that locale functions are not completly done already? HTMLArea._lc_catalog has to be defined in lang/xx.js no? I wanted to change some alerts (all writen in english...), can you tell us when it will be ready (or I am wrong..)

Offline

#13 2005-03-23 06:23:39

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?

..i will start working on this tomorrow!
don't know how difficult this will be

you can change the alerts anyway - using the old i18n-system - we then have to convert tem into the new one ofcourse...

niko


Niko

Offline

#14 2005-03-23 06:35:47

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: i18n javascript error?

Sorry niko, but I am too lazy, I prefer to wait until tomorrow... cool

Offline

#15 2005-03-25 13:26:56

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?


Niko

Offline

#16 2005-03-25 14:09:47

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: i18n javascript error?

I get a wrong message trying to download your package...???

Offline

#17 2005-03-25 14:20:15

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: i18n javascript error?

Niko,

What do you mean by :

Niko wrote:

* what happens with different charsets? If a language-file uses utf-8 (as most does) but xinha runs as iso-8859-1 the special cahrs can't be displayed.

Because it is easy to define a xinha charset for each language...

But what I also understand is there will be a problem if the editor is included in a page with another charset than the ones defined in plugin lang... In this case I think that the only solution is to provide a serverside transformer as you suggest... or as many lang as charset defined and put the charset as a locale parameter...

Offline

#18 2005-03-25 17:01:30

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?

I get a wrong message trying to download your package...???

...just tried it... it works for me! what message do you get?

What do you mean by :

...i think you do know what i mean, you wrote allready the possible answers to the problem big_smile

Because it is easy to define a xinha charset for each language...

yes, this usually is written in the file itself, but not avaliable as JS-variable.

But what I also understand is there will be a problem if the editor is included in a page with another charset than the ones defined in plugin lang... In this case I think that the only solution is to provide a serverside transformer as you suggest... or as many lang as charset defined and put the charset as a locale parameter...

probably like this: 1i8n-data is stored in a database somehwere on the xinha-site and there is a "make-lang-files"-script that creates all files in the form of
lang/de-utf-8.js
lang/de-iso5589-1.js
lang/de-...
but these would be a lot of files!!

i would prefer a server-side-script that does this convertion...

niko


Niko

Offline

#19 2005-03-25 18:12:59

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: i18n javascript error?

Yes, I get it now.. Perhaps I get it too early durig the move... Gogo was too slow tongue

Yes I think the better think is to define a "standard" charset to a language from a JS variable available and get a server side tool for conversion only when necessary.

If you force only one charset for every languages, the problem is that if you have to translate all the plugin resources at launch and I think it will take long time to launch... or you must be able to launch plugin "on demand" but gogo don't like that!!!    roll

Offline

#20 2005-04-04 04:38:08

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: i18n javascript error?

Where are we about the new I18N interface... I wanted to upgrate some alert in english and bugs in plugin, so can we consider the ticket #98 enough resolved?

Offline

#21 2005-04-04 04:54:17

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?

there are still things to clear... i will open a new thread on that


Niko

Offline

#22 2005-04-05 09:27:12

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: i18n javascript error?


Niko

Offline

Board footer

Powered by FluxBB