Opened 13 years ago

Closed 12 years ago

#39 closed enhancement (fixed)

Add images as internationalized resources

Reported by: gdo@… Owned by: niko
Priority: normal Milestone: Version 1.0
Component: Xinha Core Version: trunk
Severity: normal Keywords:
Cc: niko

Description

The images for the menu buttons are not defined as internationalized resources. We should be able to defined them as it...

Change History (11)

comment:1 Changed 13 years ago by Niko <ns@…>

what buttons would that be?
i think only the Bold/Italic/Underline?(?)

this might be done together with #98

comment:2 Changed 13 years ago by gogo

  • Cc niko added
  • Owner changed from gogo to niko

niko, can this be closed?

comment:3 Changed 13 years ago by niko

no, till now it is not possible to have internationalized ressources...
actually i don't have an idea how to do this :D

comment:4 Changed 13 years ago by gogo

  • Milestone set to Version 1.0
  • Version changed from 2.0 to trunk

Mmm, you could do a fake "translation" of image names perhaps, so instead of loading ed-blah.gif you load _lc('ed-blah.gif')?

comment:5 Changed 13 years ago by niko

not that easy as the url actually is ["ed_buttons_main.gif",1,2]

my first idea:

Enhance the language files this way:

//lang/de.js
{
        "Bold": "Fett",
        "Superscript": "Tiefgestellt",
        "Justify Left": "LinksbÃŒndig",
        toolbar: { "buttonname": "image.gif",
                   "bold"      : "de_bold.gif"
                 }
}

...this way we could later add other items that need to have i18n - like sizes of dialog-windows or whatever.

or create a new button-translation-file with just

//langbutton/de.js
{ "buttonname": "image.gif",
                   "bold"      : "de_bold.gif"
                 }

3rd idea (don't know if this is possible)

we have a ed_buttons_main.gif
why not create a ed_buttons_main_de.gif?
(this would be hard to maintin, unflexible, problematic with plugins and i don't know how we detect if a file exists)

comment:6 Changed 13 years ago by gogo

Hmm. Well, we do need to keep the combined images ( ["ed_buttons_main.gif",1,2] means the image at row 1 column 2 in ed_buttons_main) because this gives a great speed boost.

I think option 1 maybe, but, hmm, difficult, how would you have a "native" version like we do currently, you can't very well go

_lc(["ed_buttons_main.gif",1,2])

I guess we would have to have a "native" translation file as well so we have

//lang/native.js
{
  "button_bold" : ["ed_buttons_main.gif",1,2]
}

//lang/de.js
{
  "button_bold" : ["ed_buttons_main-de.gif",1,2]
}

_lc('button_bold');

so the localisation system would just need modification to first check in <_editor_lang>.js, then if it's not there in native.js, then if it's not there just use the "native key" like it does now. This would work I think?

comment:7 Changed 13 years ago by niko

sounds nice for me

i never thought about having an array in the language-file.

although we have to load one more file (for core and for all plugins) which is only needed for those three buttons. isn't this a bit of an overkill?

what would you think about a 3rd parameter for _lc "key"?
if not set the first will be used for key

_lc(["ed_buttons_main.gif",1,2], 'HTMLArea', 'button_bold')

//lang/de.js
{
  "button_bold" : ["ed_buttons_main-de.gif",1,2]
}

//and no native.js

comment:8 Changed 13 years ago by gogo

although we have to load one more file (for core and for all plugins) which is only needed for those three buttons. isn't this a bit of an overkill?

We could just put the native array in htmlarea.js itself..

HTMLArea._specialTranslations =
{
  "button_bold" : ["ed_buttons_main.gif",1,2]
}

what would you think about a 3rd parameter for _lc "key"? if not set the first will be used for key

Hmm, how about _lc(['button_bold', ["ed_buttons_main.gif",1,2]], 'HTMLArea'), ie the key to translate can either be a string _lc('Hello World') or a tuple ['key', <alt-native>]... that would be cleaner than a third argument IMHO.

comment:9 Changed 12 years ago by niko

i like this solution:

_lc(['button_bold', ["ed_buttons_main.gif",1,2]], 'HTMLArea')

i think i should implement it...

comment:10 Changed 12 years ago by niko

...but it is not that easy, because

_lc(['button_bold', ["ed_buttons_main.gif",1,2]], 'HTMLArea')

and

_lc(["ed_buttons_main.gif",1,2], 'HTMLArea')

are both valid!

so how do i find out if in the second example i have to use ed_buttons_main.gif as key?

one possibility would be this:

_lc({key: 'button_bold', string: ["ed_buttons_main.gif",1,2]}, 'HTMLArea')

thinking about that we could even add a 3rd key "replace" - instead of the 3rd agument as i did just for #291

comment:11 Changed 12 years ago by niko

  • Resolution set to fixed
  • Status changed from new to closed

commited this in changeset:290
for german i added allready 3 buttons

currenlty only bold, italic, strikethrough, subscript, superscript and underline can be translated.

see wiki:Documentation/Localisation for more information

Note: See TracTickets for help on using tickets.