Bug 499144 - Provide a standard service for message translation (I18N)
Summary: Provide a standard service for message translation (I18N)
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-08-04 06:03 EDT by Pierre-Charles David CLA
Modified: 2016-09-19 09:17 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Charles David CLA 2016-08-04 06:03:53 EDT
Bug #459993 and related provided the bulk of I18N support, for the Sirius UI itself and the fixed strings defined in the VSM. One part still missing is a standard way for specifiers to internationalize the dynamic parts of their VSMs (where relevant).

We should provide a standard service method for this (usable from any interpreted expression written using a query language that supports services), to avoid each specifier having to recreate his own.

A first idea would be a signature like this:

  getLocalizedMessage(EObject self, String msgKey)

which would use the same kind of mechanics as MessageTranslator.getMessage(EObject, String) (adapted) to convert a key ("%message") into the corresponding tranlation depending on the current locale and translations available.

In the context of I18N, the "layout" of a message can generaly not be fixed, so an expression like

  aql:'prefix' + self.foo() + 'suffix'

should not be converted into

  aql:self.getLocalizedMessage('%prefix') + self.foo() + self.getLocalizedMessage('%suffix')

but more likely into something like:

  aql:self.formatMessage(self.getLocalizedMessage('%key'), self.foo())

with the value of %message being a pattern as understood by MessageFormat.format().

The result is rather cumbersome, so maybe we need a shorter form for the common case.