Ticket #39 (closed enhancement: fixed)

Opened 8 years ago

Last modified 8 years ago

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

Changed 8 years ago by Niko <ns@…>

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

this might be done together with #98

Changed 8 years ago by gogo

  • cc niko added
  • owner changed from gogo to niko

niko, can this be closed?

Changed 8 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

Changed 8 years ago by gogo

  • version changed from 2.0 to trunk
  • milestone set to Version 1.0

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

Changed 8 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)

Changed 8 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?

Changed 8 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

Changed 8 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.

Changed 8 years ago by niko

i like this solution:

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

i think i should implement it...

Changed 8 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

Changed 8 years ago by niko

  • status changed from new to closed
  • resolution set to fixed

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.