Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 186743 Details for
Bug 331260
Implement an extensible translation service
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch alternative v.2 demo
patch translation Oleg demo 3.txt (text/plain), 10.09 KB, created by
Oleg Besedin
on 2011-01-13 11:17:57 EST
(
hide
)
Description:
Patch alternative v.2 demo
Filename:
MIME Type:
Creator:
Oleg Besedin
Created:
2011-01-13 11:17:57 EST
Size:
10.09 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.e4.demo.contacts >Index: Application.e4xmi >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/examples/org.eclipse.e4.demo.contacts/Application.e4xmi,v >retrieving revision 1.17 >diff -u -r1.17 Application.e4xmi >--- Application.e4xmi 1 Dec 2010 19:06:49 -0000 1.17 >+++ Application.e4xmi 13 Jan 2011 16:14:50 -0000 >@@ -10,7 +10,7 @@ > </children> > </children> > <mainMenu xmi:id="menu:org.eclipse.ui.main.menu" elementId="menu:org.eclipse.ui.main.menu"> >- <children xsi:type="menu:Menu" xmi:id="_SeXUD-8EEd6FC9cDb6iV7g" elementId="_SeXUD-8EEd6FC9cDb6iV7g" label="File"> >+ <children xsi:type="menu:Menu" xmi:id="_SeXUD-8EEd6FC9cDb6iV7g" elementId="_SeXUD-8EEd6FC9cDb6iV7g" label="%fileMenu"> > <children xsi:type="menu:HandledMenuItem" xmi:id="_SeXUEO8EEd6FC9cDb6iV7g" elementId="_SeXUEO8EEd6FC9cDb6iV7g" label="Save" iconURI="platform:/plugin/org.eclipse.e4.demo.contacts/icons/silk/disk.png" command="contacts.save"/> > <children xsi:type="menu:HandledMenuItem" xmi:id="_SeXUEe8EEd6FC9cDb6iV7g" elementId="_SeXUEe8EEd6FC9cDb6iV7g" label="Delete" iconURI="platform:/plugin/org.eclipse.e4.demo.contacts/icons/silk/user_delete.png" command="contacts.delete"/> > <children xsi:type="menu:DirectMenuItem" xmi:id="_SeXUEu8EEd6FC9cDb6iV7g" elementId="_SeXUEu8EEd6FC9cDb6iV7g" label="Direct Exit" contributionURI="platform:/plugin/org.eclipse.e4.demo.contacts/org.eclipse.e4.demo.contacts.handlers.ExitHandler"/> >Index: build.properties >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/examples/org.eclipse.e4.demo.contacts/build.properties,v >retrieving revision 1.4 >diff -u -r1.4 build.properties >--- build.properties 16 Apr 2010 17:28:17 -0000 1.4 >+++ build.properties 13 Jan 2011 16:14:50 -0000 >@@ -10,4 +10,6 @@ > css/,\ > splash.bmp,\ > plugin_customization.ini,\ >- vcards/ >+ vcards/,\ >+ plugin_ru.properties,\ >+ plugin.properties >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/examples/org.eclipse.e4.demo.contacts/META-INF/MANIFEST.MF,v >retrieving revision 1.15 >diff -u -r1.15 MANIFEST.MF >--- META-INF/MANIFEST.MF 24 Jun 2010 14:19:44 -0000 1.15 >+++ META-INF/MANIFEST.MF 13 Jan 2011 16:14:50 -0000 >@@ -24,12 +24,14 @@ > org.eclipse.e4.ui.bindings;bundle-version="0.9.0", > org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", > org.eclipse.e4.ui.css.swt;bundle-version="0.9.1", >- org.eclipse.e4.ui.di;bundle-version="0.9.0" >+ org.eclipse.e4.ui.di;bundle-version="0.9.0", >+ org.eclipse.e4.core.services;bundle-version="0.9.1" > Bundle-ActivationPolicy: lazy > Bundle-Vendor: Eclipse.org > Import-Package: javax.annotation;version="1.0.0", > javax.inject;version="1.0.0" > Bundle-Activator: org.eclipse.e4.demo.contacts.BundleActivatorImpl > Export-Package: org.eclipse.e4.demo.contacts.model >+Bundle-Localization: plugin > > >Index: plugin.properties >=================================================================== >RCS file: plugin.properties >diff -N plugin.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ plugin.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+############################################################################### >+# Copyright (c) 2011 IBM Corporation and others. >+# All rights reserved. This program and the accompanying materials >+# are made available under the terms of the Eclipse Public License v1.0 >+# which accompanies this distribution, and is available at >+# http://www.eclipse.org/legal/epl-v10.html >+# >+# Contributors: >+# IBM Corporation - initial API and implementation >+############################################################################### >+fileMenu = &File >Index: plugin_ru.properties >=================================================================== >RCS file: plugin_ru.properties >diff -N plugin_ru.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ plugin_ru.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+############################################################################### >+# Copyright (c) 2011 IBM Corporation and others. >+# All rights reserved. This program and the accompanying materials >+# are made available under the terms of the Eclipse Public License v1.0 >+# which accompanies this distribution, and is available at >+# http://www.eclipse.org/legal/epl-v10.html >+# >+# Contributors: >+# IBM Corporation - initial API and implementation >+############################################################################### >+fileMenu = &\u0424\u0430\u0439\u043B >Index: src/org/eclipse/e4/demo/contacts/model/internal/BinaryTranslatorProvider.java >=================================================================== >RCS file: src/org/eclipse/e4/demo/contacts/model/internal/BinaryTranslatorProvider.java >diff -N src/org/eclipse/e4/demo/contacts/model/internal/BinaryTranslatorProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/e4/demo/contacts/model/internal/BinaryTranslatorProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,31 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.e4.demo.contacts.model.internal; >+ >+import org.eclipse.e4.core.services.translation.TranslationService; >+ >+public class BinaryTranslatorProvider extends TranslationService { >+ >+ @Override >+ public String translate(String key, String contributorURI) { >+ if (key == null) >+ return null; >+ char[] charArray = key.toCharArray(); >+ StringBuffer tmp = new StringBuffer(); >+ tmp.append("0x"); >+ for(int i = 0; i < charArray.length; i++) { >+ int value = charArray[i]; >+ tmp.append(Integer.toHexString(value)); >+ } >+ return tmp.toString(); >+ } >+ >+} >Index: src/org/eclipse/e4/demo/contacts/model/internal/ModelLifeCycleExtension.java >=================================================================== >RCS file: src/org/eclipse/e4/demo/contacts/model/internal/ModelLifeCycleExtension.java >diff -N src/org/eclipse/e4/demo/contacts/model/internal/ModelLifeCycleExtension.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/e4/demo/contacts/model/internal/ModelLifeCycleExtension.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.e4.demo.contacts.model.internal; >+ >+import javax.inject.Inject; >+import org.eclipse.e4.core.contexts.ContextInjectionFactory; >+import org.eclipse.e4.core.contexts.IEclipseContext; >+import org.eclipse.e4.core.services.translation.TranslationService; >+import org.eclipse.e4.ui.model.application.MApplication; >+import org.eclipse.e4.ui.workbench.lifecycle.ProcessRemovals; >+ >+public class ModelLifeCycleExtension { >+ >+ @Inject >+ public ModelLifeCycleExtension() { >+ // placeholder >+ } >+ >+ @ProcessRemovals >+ public void overrideTranslation(MApplication application) { >+ IEclipseContext appContext = application.getContext(); >+ BinaryTranslatorProvider translationService = ContextInjectionFactory.make(BinaryTranslatorProvider.class, appContext); >+ appContext.set(TranslationService.class, translationService); >+ } >+ >+} >#P org.eclipse.e4.ui.workbench.renderers.swt >Index: src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java,v >retrieving revision 1.6 >diff -u -r1.6 MenuManagerRenderer.java >--- src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java 18 Nov 2010 20:35:56 -0000 1.6 >+++ src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java 13 Jan 2011 16:14:51 -0000 >@@ -25,8 +25,10 @@ > import org.eclipse.e4.core.contexts.RunAndTrack; > import org.eclipse.e4.core.services.events.IEventBroker; > import org.eclipse.e4.core.services.log.Logger; >+import org.eclipse.e4.core.services.translation.TranslationService; > import org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer; > import org.eclipse.e4.ui.model.application.MApplication; >+import org.eclipse.e4.ui.model.application.MApplicationElement; > import org.eclipse.e4.ui.model.application.ui.MCoreExpression; > import org.eclipse.e4.ui.model.application.ui.MElementContainer; > import org.eclipse.e4.ui.model.application.ui.MUIElement; >@@ -754,7 +756,18 @@ > if (text == null || text.length() == 0) { > return NO_LABEL; > } >- return text; >+ // XXX >+ return translate(text, menuModel); >+ } >+ >+ private String translate(String key, MApplicationElement element) { >+ IEclipseContext parentContext = modelService >+ .getContainingContext((MUIElement) element); >+ TranslationService translation = parentContext >+ .get(TranslationService.class); >+ String translated = translation.translate(key, >+ element.getContributorURI()); >+ return translated; > } > > private ImageDescriptor getImageDescriptor(MUILabel element) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 331260
:
183968
|
184155
|
185001
|
185457
|
186664
|
186665
|
186735
|
186742
|
186743
|
186844