Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » Localization
Localization [message #1739630] Wed, 03 August 2016 11:51 Go to next message
Luca Forni is currently offline Luca ForniFriend
Messages: 2
Registered: July 2009
Junior Member
Hi all,
i know there is a page on developer guide ( https://www.eclipse.org/sapphire/releases/9.0.5/documentation/focus/localization/index.html ) but i don't understand it at all.
For example, i don't understand when it says "The string resource files that will be translated are created at build time", but what build is it? (tycho, maven, ant, eclipse export,....)
I tried a lot of ways unsuccessfully.

Please, could someone make a sample? or a step by step tutorial?

Thanks
Luca
Re: Localization [message #1739690 is a reply to message #1739630] Wed, 03 August 2016 20:22 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
It looks like this document is out of date. I will make a note to update it. Exporting property files at build time was a feature of Sapphire when Sapphire utilized an annotation processor for generating element implementation classes. With the move to runtime bytecode generation, the localization strategy was changed.

Here is a brief overview:

For Example.java element interface, Sapphire looks for Example.property file and a property file with the current locale suffix in the same location. Similar approach is used for sdef files. The keys used in the property files aren't important to the framework. The only thing that matters is that (a) the default locale file has an entry whose text matches the text used in the .java/.sdef file, and (b) the key for this entry in the default locale file matches the key in the current locale file.

Example.properties

1 = hello
2 = goodbye

Example_fr.properties

1 = bonjour
2 = au revoir

Re: Localization [message #1739811 is a reply to message #1739690] Thu, 04 August 2016 16:25 Go to previous messageGo to next message
Luca Forni is currently offline Luca ForniFriend
Messages: 2
Registered: July 2009
Junior Member
Thank you!
I tried what you suggest and it works well on java files (like Example.java sample) but it doesn't work on sdef file.

On sdef file i tried this:
- I created SampleEditor.sdef in org.sample.sapphire.editor package and its content is something like this:
<?xml version="1.0" encoding="UTF-8"?>
<definition>
	<form-editor-page>
		<element-type>org.sample.sapphire.editor.Sample
		</element-type>
		<content>
			<section>
				<label>General Parameter</label>
				<content>
...

- then I created SampleEditor.properties in org.sample.sapphire.editor package and its content is something like this:
general-parameter=General Parameter
...

- then I created SampleEditor_it.properties in org.sample.sapphire.editor package and its content is something like this:
general-parameter=Parametri Generali
...


When i open that editor in an RCP with italian localization, i see always "General Parameter" instead of "Parametri Generali".
In the same editor all other label defined in java files are translated well in italian according to what i wrote on property files.

Any suggestion?
Thank you very much

PS: I use sapphire 9.0.5 version on Neon
Re: Localization [message #1739830 is a reply to message #1739811] Thu, 04 August 2016 19:32 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
Unfortunately, it looks like there have been some regressions to the localization system. I'd like to get these issues fixed, so I will setup a sample and start working on the fixes. If you are able to help our with testing dev build, that would help speed the process along.
Re: Localization [message #1740442 is a reply to message #1739830] Fri, 12 August 2016 19:58 Go to previous message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
I have spent several days going over Sapphire localization and fixing a few regressions. The result of this effort can be seen in the following screen capture that shows Sapphire contacts sample running with Russian localization.

index.php/fa/26744/0/

The fixes are available on 8.3, 9.1 and 10 code lines, which are all available from Sapphire build server.

https://hudson.eclipse.org/sapphire/

There are three parts to Sapphire localization:

1. Localizing the model
2. Localizing the sdef file
3. Localizing the framework

The last part includes strings coming from the framework itself, from built-in validators, UI components, etc. This part must be done by enhancing the framework itself. Currently, Sapphire does not ship with any localizations, apart from a partial Russian localization that I added as part of these fixes.

It sounds like you are interested in Italian localization. If you'd like to contribute Italian framework localization, that you can then consume for your project's localization, please open a bug and provide translations for English strings that you see in UI that are coming from the framework.
  • Attachment: localized.png
    (Size: 37.31KB, Downloaded 422 times)

[Updated on: Fri, 12 August 2016 19:59]

Report message to a moderator

Previous Topic:initialize() method not propogating to child types reference via possible attribute in Type annotati
Next Topic:Survey of adopters on Sapphire 8.x
Goto Forum:
  


Current Time: Tue Mar 19 11:56:58 GMT 2024

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

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

Back to the top