Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] localize buttons and text

oh one last thing! Can I call a different .properties file from the
run configuration for the translation of the labels and buttons? like
the way I can call the file to translate the titles on the trimmed
windows etc?
Deirdre.
On 6/9/11, Deidre Stankard <deirdrestankard@xxxxxxxxx> wrote:
> Sorry tom it was the batik problem again, when I re-launched it
> brought them back to 1.7.
> Thanks very much for your help.
> Greatly appreciated.
> Deirdre.
> On 6/9/11, Deidre Stankard <deirdrestankard@xxxxxxxxx> wrote:
>> That is brill thanks.
>> But of course nothing works out for me!
>> I am getting the following errors:
>> !SESSION 2011-06-09 19:37:40.000
>> -----------------------------------------------
>> eclipse.buildId=unknown
>> java.version=1.6.0_02
>> java.vendor=Sun Microsystems Inc.
>> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de
>> Framework arguments:  -product de.vogella.e4.todo.product
>> Command-line arguments:  -product de.vogella.e4.todo.product -data
>> C:\Documents and Settings\Deirdre
>> Stankard\Desktop\v11/../runtime-Todo.product -dev file:C:/Documents
>> and Settings/Deirdre
>> Stankard/Desktop/v11/.metadata/.plugins/org.eclipse.pde.core/Todo.product/dev.properties
>> -os win32 -ws win32 -arch x86 -consoleLog
>>
>> !ENTRY org.eclipse.osgi 4 0 2011-06-09 19:37:42.140
>> !MESSAGE An error occurred while automatically activating bundle
>> org.eclipse.emf.ecore (35).
>> !STACK 0
>> org.osgi.framework.BundleException: Exception in
>> org.eclipse.emf.ecore.plugin.EcorePlugin$Implementation.start() of
>> bundle org.eclipse.emf.ecore.
>> 	at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
>> 	at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
>> 	at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
>> 	at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
>> 	at
>> org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
>> 	at
>> org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
>> 	at
>> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:462)
>> 	at
>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
>> 	at
>> org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>> 	at
>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>> 	at java.lang.ClassLoader.loadClass(Unknown Source)
>> 	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>> 	at java.lang.Class.getDeclaredConstructors0(Native Method)
>> 	at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
>> 	at java.lang.Class.getDeclaredConstructors(Unknown Source)
>> 	at
>> org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:279)
>> 	at
>> org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:237)
>> 	at
>> org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:153)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:90)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:64)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:343)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:215)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:130)
>> 	at
>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>> 	at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>> 	at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>> 	at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
>> 	at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> 	at java.lang.reflect.Method.invoke(Unknown Source)
>> 	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
>> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
>> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
>> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
>> Caused by: java.lang.NoClassDefFoundError:
>> org/eclipse/core/resources/ResourcesPlugin
>> 	at
>> org.eclipse.emf.ecore.plugin.EcorePlugin$Implementation.start(EcorePlugin.java:520)
>> 	at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
>> 	at java.security.AccessController.doPrivileged(Native Method)
>> 	at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
>> 	... 41 more
>> Root exception:
>> java.lang.NoClassDefFoundError:
>> org/eclipse/core/resources/ResourcesPlugin
>> 	at
>> org.eclipse.emf.ecore.plugin.EcorePlugin$Implementation.start(EcorePlugin.java:520)
>> 	at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
>> 	at java.security.AccessController.doPrivileged(Native Method)
>> 	at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
>> 	at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
>> 	at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
>> 	at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
>> 	at
>> org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
>> 	at
>> org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
>> 	at
>> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:462)
>> 	at
>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
>> 	at
>> org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>> 	at
>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>> 	at
>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>> 	at java.lang.ClassLoader.loadClass(Unknown Source)
>> 	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>> 	at java.lang.Class.getDeclaredConstructors0(Native Method)
>> 	at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
>> 	at java.lang.Class.getDeclaredConstructors(Unknown Source)
>> 	at
>> org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:279)
>> 	at
>> org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:237)
>> 	at
>> org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:153)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:90)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:64)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:343)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:215)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:130)
>> 	at
>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>> 	at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>> 	at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>> 	at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
>> 	at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> 	at java.lang.reflect.Method.invoke(Unknown Source)
>> 	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
>> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
>> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
>> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
>>
>> !ENTRY org.eclipse.osgi 4 0 2011-06-09 19:37:42.156
>> !MESSAGE Application error
>> !STACK 1
>> java.lang.NoClassDefFoundError: org/eclipse/emf/ecore/resource/Resource
>> 	at java.lang.Class.getDeclaredConstructors0(Native Method)
>> 	at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
>> 	at java.lang.Class.getDeclaredConstructors(Unknown Source)
>> 	at
>> org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:279)
>> 	at
>> org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:237)
>> 	at
>> org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:153)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:90)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:64)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:343)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:215)
>> 	at
>> org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:130)
>> 	at
>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>> 	at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>> 	at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>> 	at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
>> 	at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> 	at java.lang.reflect.Method.invoke(Unknown Source)
>> 	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
>> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
>> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
>> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
>> An error has occurred. See the log file
>>
>>
>> Would that be cause because I am doing translation aswel in the
>> Application.e4xmi using the '%' command??
>> Can I do both at the same time?
>>
>> Deirdre.
>> On 6/9/11, Tom Schindl <tom.schindl@xxxxxxxxxxxxxxx> wrote:
>>> Hi,
>>>
>>> The process is like this (these are the manual steps you can let the IDE
>>> extract the strings for you):
>>>
>>> a) Create a "Messages.properties"-File in package "foo"
>>> b) Create a Java-Class-File "Messages.java" in package "foo"
>>> c) Create an entry like "MyPart_Label=Hello" in the Messages.properties
>>> d) Create a field "String MyPart_Label" in your Messages.java
>>> e) Add a dependency to "org.eclipse.e4.tools.services" to your
>>>    MANIFEST.MF
>>> f) Modify your Part-Class from something like this:
>>>
>>> -------8<-------
>>> public class MyPart {
>>>   @Inject
>>>   public MyPart(Composite parent) {
>>>    // ...
>>>    title = new Label(parent, SWT.CENTER);
>>>    GridData titleLData = new GridData();
>>>    titleLData.heightHint = 69;
>>>    titleLData.grabExcessVerticalSpace = true;
>>>    titleLData.verticalAlignment = GridData.BEGINNING;
>>>    titleLData.grabExcessHorizontalSpace = true;
>>>    titleLData.horizontalAlignment = GridData.FILL;
>>>    title.setLayoutData(titleLData);
>>>    title.setText("Hello");
>>>    title.setData("org.eclipse.e4.ui.css.id", "SeparatorLabel");
>>>   }
>>> }
>>> -------8<-------
>>>
>>> To something like this:
>>> -------8<-------
>>> public class MyPart {
>>>   @Inject
>>>   public MyPart(Composite comp, @Translation Messages messages) {
>>>    // ...
>>>    title = new Label(parent, SWT.CENTER);
>>>    GridData titleLData = new GridData();
>>>    titleLData.heightHint = 69;
>>>    titleLData.grabExcessVerticalSpace = true;
>>>    titleLData.verticalAlignment = GridData.BEGINNING;
>>>    titleLData.grabExcessHorizontalSpace = true;
>>>    titleLData.horizontalAlignment = GridData.FILL;
>>>    title.setLayoutData(titleLData);
>>>    title.setText(messages.MyPart_Label);
>>>    title.setData("org.eclipse.e4.ui.css.id", "SeparatorLabel");
>>>   }
>>> }
>>> -------8<-------
>>>
>>> That's it. Don't forget to update your launch config and .product after
>>> having added the new org.eclipse.e4.tools.services dependency
>>>
>>> Tom
>>>
>>> Am 09.06.11 20:06, schrieb Deidre Stankard:
>>>> yes I do think I will do it the way you do your modeltooling but I am
>>>> a little confused of how it is working.
>>>> Say for example I have a label called like such:
>>>>                 title = new Label(parent, SWT.CENTER);
>>>> 		GridData titleLData = new GridData();
>>>> 		titleLData.heightHint = 69;
>>>> 		titleLData.grabExcessVerticalSpace = true;
>>>> 		titleLData.verticalAlignment = GridData.BEGINNING;
>>>> 		titleLData.grabExcessHorizontalSpace = true;
>>>> 		titleLData.horizontalAlignment = GridData.FILL;
>>>> 		title.setLayoutData(titleLData);
>>>> 		title.setText("Hello");
>>>> 		title.setData("org.eclipse.e4.ui.css.id", "SeparatorLabel");
>>>>
>>>> To be able to change the text within the label from Hello to say
>>>> french. How can I call title in the .properties?
>>>>
>>>> Deirdre.
>>>>
>>>> On 6/8/11, Tom Schindl <tom.schindl@xxxxxxxxxxxxxxx> wrote:
>>>>> There are 2 possibilties:
>>>>> * doing it in the 3.x way using NLS-System
>>>>> * doing it like my modeltooling does it
>>>>>
>>>>> -http://dev.eclipse.org/viewcvs/viewvc.cgi/e4/org.eclipse.e4.tools/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java?view=markup
>>>>>
>>>>> -http://dev.eclipse.org/viewcvs/viewvc.cgi/e4/org.eclipse.e4.tools/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java?view=markup
>>>>>
>>>>> -http://dev.eclipse.org/viewcvs/viewvc.cgi/e4/org.eclipse.e4.tools/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties?view=markup
>>>>>
>>>>> I think my way of doing it is better because:
>>>>> a) messages don't stay in memory for ever
>>>>> b) it will support multiple locales at once and dynamic language
>>>>>    switching
>>>>>
>>>>> Tom
>>>>>
>>>>> Am 08.06.11 21:41, schrieb Deidre Stankard:
>>>>>> Hi,
>>>>>>
>>>>>> I am undergoing localization in my project in eclipse 4.1 and I can
>>>>>> localize trimmed windows and on my toolbar etc which are all done in
>>>>>> the
>>>>>> application.e4xmi using the '%' call in the label.
>>>>>> I am just wondering can localization be used in eclipse 4.1 with
>>>>>> names
>>>>>> on my buttons and text within my GUI as these are called in my java
>>>>>> files? and if so how?
>>>>>>
>>>>>> Regards,
>>>>>> Deirdre.
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> e4-dev mailing list
>>>>>> e4-dev@xxxxxxxxxxx
>>>>>> https://dev.eclipse.org/mailman/listinfo/e4-dev
>>>>>
>>>>> _______________________________________________
>>>>> e4-dev mailing list
>>>>> e4-dev@xxxxxxxxxxx
>>>>> https://dev.eclipse.org/mailman/listinfo/e4-dev
>>>>>
>>>> _______________________________________________
>>>> e4-dev mailing list
>>>> e4-dev@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/e4-dev
>>>
>>> _______________________________________________
>>> e4-dev mailing list
>>> e4-dev@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/e4-dev
>>>
>>
>


Back to the top