Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Localization questions
EMF Localization questions [message #1239276] Mon, 03 February 2014 20:56 Go to next message
Patrick Tournet is currently offline Patrick TournetFriend
Messages: 17
Registered: July 2009
Location: Aix-en-Provence, FRANCE
Junior Member
Hello everyone,

I'm still discovering EMF (I'm reading right now the 2nd edition of the EMF book), but keeping in mind the upcoming challenges of my project and especially the multi-lingual capabilities. And as I haven't found all the answers yet in all I've read, I'm turning to you...

As an example framework for my questions, I'll use the Library tutorial (a Library contains Books and Writers, a Book has a Writer, a Writer has written Books, ...)

First of all, the easy part (I think) : if my app should support English and French, I'd like to read {Library, Book, Writer} or {Bibliothèque, Livre, Auteur} based on the active language. I've seen that the strings are located in the plugin.properties of the .edit plugin, so my guess is that there must be a way to create localized plugins to load the resources from.

But, assuming, I'm right, is there a way to achieve that, with runtime editable strings ? (I don't want to have to compile a plugin to get a new translation). I suppose there is, but where should I look to find how to do it ?

The second, would be the icing of the previous cake : I've seen that the model can be persisted as a XMI file and that is really nice. But is there a way to make the XML tags also localizable ? (ex: <writer name="JRR Tolkien"> or <auteur nom="JRR Tolkien"> based on the current language). I'm aware that would imply a new XML Schema for each language, but that could be a very valuable asset in some cases (especially in companies that operate in several countries and where not everyone speak one common language).

At last, I need to be able to achieve the localization of the objects, meaning that a book has a title, yes, but not the same in French and English (except for 1984 Very Happy ). And I would like to have only 1 book, but getting "The hobbit" or "Bilbo, le hobbit" as its title depending on the language I'm using.

Of course, creating a "title_en" and a "title_fr" String as EAttribute of Book is not an option, as I would like to be able to add more languages without having to update the model. I guess it should be a fairly standard issue, but as I failed to come across a solution, any pointer would be appreciated.

Thanks for your time.


I can do anything and I can do it better than anyone. Be as I am : be the best ! Wink
Re: EMF Localization questions [message #1240968 is a reply to message #1239276] Fri, 07 February 2014 09:28 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Patrick,

Comments below.

On 03/02/2014 9:56 PM, Patrick TOURNET wrote:
> Hello everyone,
>
> I'm still discovering EMF (I'm reading right now the 2nd edition of
> the EMF book), but keeping in mind the upcoming challenges of my
> project and especially the multi-lingual capabilities. And as I
> haven't found all the answers yet in all I've read, I'm turning to you...
>
> As an example framework for my questions, I'll use the Library
> tutorial (a Library contains Books and Writers, a Book has a Writer, a
> Writer has written Books, ...)
>
> First of all, the easy part (I think) : if my app should support
> English and French, I'd like to read {Library, Book, Writer} or
> {Bibliothèque, Livre, Auteur} based on the active language. I've seen
> that the strings are located in the plugin.properties of the .edit
> plugin, so my guess is that there must be a way to create localized
> plugins to load the resources from.
Yes, generally you'd have additional plugin.properties for the different
languages. But the'd not be additional plugins. You could put them in
the same plugin or contribute them via fragments. You can look at how
http://www.eclipse.org/babel/ provides translations for such things.
>
> But, assuming, I'm right, is there a way to achieve that, with runtime
> editable strings ? (I don't want to have to compile a plugin to get a
> new translation). I suppose there is, but where should I look to find
> how to do it ?
Runtime editable is asking for a lot. Even dynamic switching of locales
is not generally supported.
>
> The second, would be the icing of the previous cake : I've seen that
> the model can be persisted as a XMI file and that is really nice. But
> is there a way to make the XML tags also localizable ? (ex: <writer
> name="JRR Tolkien"> or <auteur nom="JRR Tolkien"> based on the current
> language).
No, definitely not. You should try to avoid such things. Translation
should be focused on the presentation to the user, not changing the
persistence representation.
> I'm aware that would imply a new XML Schema for each language, but
> that could be a very valuable asset in some cases (especially in
> companies that operate in several countries and where not everyone
> speak one common language).
Sounds like a bit of a disaster...
>
> At last, I need to be able to achieve the localization of the objects,
> meaning that a book has a title, yes, but not the same in French and
> English (except for 1984 :d ). And I would like to have only 1 book,
> but getting "The hobbit" or "Bilbo, le hobbit" as its title depending
> on the language I'm using.
That's also quite tricky. There's nothing special in EMF to support
such things, and even if you were to hand do something like that in Java
directly, you're faced with the same problem, i.e., how to represent that?
>
> Of course, creating a "title_en" and a "title_fr" String as EAttribute
> of Book is not an option, as I would like to be able to add more
> languages without having to update the model.
Yes, that would be very ugly...
> I guess it should be a fairly standard issue, but as I failed to come
> across a solution, any pointer would be appreciated.
It's a tricky problem and I'm not sure anyone even has an good "hand
written Java" solutions for it.
> Thanks for your time.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF reference management
Next Topic:Annotated Java import issues with EMF 2.9
Goto Forum:
  


Current Time: Fri Apr 19 16:09:14 GMT 2024

Powered by FUDForum. Page generated in 0.02614 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top