Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2014-10-29 19:30:32 -0400
committerTom Schindl2014-10-29 19:30:32 -0400
commite66678f7ae7bae5cfabe24b50b1380640fdbc640 (patch)
tree75f6694ec2e948285d9d14fa2237bf761688be24
parent5b3c5b83b102d1e3f8ab5cda231b5e05c7a972bd (diff)
downloadorg.eclipse.efxclipse-e66678f7ae7bae5cfabe24b50b1380640fdbc640.tar.gz
org.eclipse.efxclipse-e66678f7ae7bae5cfabe24b50b1380640fdbc640.tar.xz
org.eclipse.efxclipse-e66678f7ae7bae5cfabe24b50b1380640fdbc640.zip
adding l10n samples
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app.product/org.eclipse.fx.testcases.l10n.app.product.product.launch2
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/.classpath5
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/.project6
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/Application.e4xmi2
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/META-INF/MANIFEST.MF10
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages.java6
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages.properties2
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessagesRegistry.java44
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages_de.properties2
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages_en.properties2
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages.java8
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages.properties4
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessagesRegistry.java103
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages_de.properties4
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages_en.properties4
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/Message.l10n33
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/MyFormatter.java19
-rw-r--r--demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/SamplePart.java39
19 files changed, 294 insertions, 8 deletions
diff --git a/demos/org.eclipse.fx.testcases.l10n.app.product/org.eclipse.fx.testcases.l10n.app.product.product.launch b/demos/org.eclipse.fx.testcases.l10n.app.product/org.eclipse.fx.testcases.l10n.app.product.product.launch
index 35ccaf8f1..8564d7e04 100644
--- a/demos/org.eclipse.fx.testcases.l10n.app.product/org.eclipse.fx.testcases.l10n.app.product.product.launch
+++ b/demos/org.eclipse.fx.testcases.l10n.app.product/org.eclipse.fx.testcases.l10n.app.product.product.launch
@@ -8,7 +8,7 @@
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="false"/>
-<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/org.eclipse.fx.testcases.l10n.app.product.product"/>
<booleanAttribute key="default" value="false"/>
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/.classpath b/demos/org.eclipse.fx.testcases.l10n.app/.classpath
index 3bc247511..f0c554985 100644
--- a/demos/org.eclipse.fx.testcases.l10n.app/.classpath
+++ b/demos/org.eclipse.fx.testcases.l10n.app/.classpath
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="src-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/.project b/demos/org.eclipse.fx.testcases.l10n.app/.project
index 1b4de8e2d..31c988216 100644
--- a/demos/org.eclipse.fx.testcases.l10n.app/.project
+++ b/demos/org.eclipse.fx.testcases.l10n.app/.project
@@ -6,6 +6,11 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
@@ -24,5 +29,6 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/.settings/org.eclipse.jdt.core.prefs b/demos/org.eclipse.fx.testcases.l10n.app/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..0c68a61dc
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/Application.e4xmi b/demos/org.eclipse.fx.testcases.l10n.app/Application.e4xmi
index 7d8eb6662..70d3c1c75 100644
--- a/demos/org.eclipse.fx.testcases.l10n.app/Application.e4xmi
+++ b/demos/org.eclipse.fx.testcases.l10n.app/Application.e4xmi
@@ -4,7 +4,7 @@
<children xsi:type="basic:PartStack" xmi:id="_vIvX0Fr7EeS5TKc3qjGXdA" elementId="org.eclipse.fx.testcases.l10n.app.partstack.0">
<children xsi:type="basic:Part" xmi:id="_viJWUFr7EeS5TKc3qjGXdA" elementId="org.eclipse.fx.testcases.l10n.app.part.1" contributionURI="bundleclass://org.eclipse.fx.testcases.l10n.app/org.eclipse.fx.testcases.l10n.app.SamplePart" label="%part.label.1"/>
<children xsi:type="advanced:Placeholder" xmi:id="_ysqKgFr7EeS5TKc3qjGXdA" elementId="org.eclipse.fx.testcases.l10n.app.placeholder.0" ref="_hE97EFr7EeS5TKc3qjGXdA"/>
- <children xsi:type="basic:Part" xmi:id="_1OaKAFsFEeS5TKc3qjGXdA" elementId="org.eclipse.fx.testcases.l10n.app.part.2" label="%part.label.1"/>
+ <children xsi:type="basic:Part" xmi:id="_1OaKAFsFEeS5TKc3qjGXdA" elementId="org.eclipse.fx.testcases.l10n.app.part.2" contributionURI="bundleclass://org.eclipse.fx.testcases.l10n.app/org.eclipse.fx.testcases.l10n.app.SamplePart" label="%part.label.1"/>
</children>
<sharedElements xsi:type="basic:Part" xmi:id="_hE97EFr7EeS5TKc3qjGXdA" elementId="org.eclipse.fx.testcases.l10n.app.part.0" contributionURI="bundleclass://org.eclipse.fx.testcases.l10n.app/org.eclipse.fx.testcases.l10n.app.SamplePart" label="%part.label.2"/>
<trimBars xmi:id="_MGpRkFr8EeS5TKc3qjGXdA" elementId="org.eclipse.fx.testcases.l10n.app.trimbar.0">
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/META-INF/MANIFEST.MF b/demos/org.eclipse.fx.testcases.l10n.app/META-INF/MANIFEST.MF
index f4c59385f..9fb147f10 100644
--- a/demos/org.eclipse.fx.testcases.l10n.app/META-INF/MANIFEST.MF
+++ b/demos/org.eclipse.fx.testcases.l10n.app/META-INF/MANIFEST.MF
@@ -19,7 +19,10 @@ Require-Bundle: org.eclipse.fx.ui.workbench.fx,
org.eclipse.core.databinding.property,
org.eclipse.e4.ui.workbench,
org.eclipse.e4.ui.services,
- javax.inject
+ javax.inject,
+ org.eclipse.fx.core.di;bundle-version="1.1.0",
+ org.eclipse.fx.core;bundle-version="1.1.0",
+ org.eclipse.jdt.annotation;bundle-version="2.0.0";resolution:=optional
Import-Package: javafx.animation;version="2.0.0",
javafx.application;version="2.0.0",
javafx.beans;version="2.0.0",
@@ -48,5 +51,6 @@ Import-Package: javafx.animation;version="2.0.0",
javafx.stage;version="2.0.0",
javafx.util;version="2.0.0",
javax.annotation;version="1.0.0",
- javax.inject;version="1.0.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+ javax.inject;version="1.0.0",
+ org.apache.commons.lang.text;version="2.6.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages.java b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages.java
new file mode 100644
index 000000000..5da5ca6c1
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages.java
@@ -0,0 +1,6 @@
+package org.eclipse.fx.testcases.l10n.app;
+
+public class BasicMessages {
+ public String BasicYes;
+ public String BasicDyn;
+}
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages.properties b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages.properties
new file mode 100644
index 000000000..dc9bc55fa
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages.properties
@@ -0,0 +1,2 @@
+BasicYes = Yes
+BasicDyn = EN: ${val}
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessagesRegistry.java b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessagesRegistry.java
new file mode 100644
index 000000000..e5e9bf90d
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessagesRegistry.java
@@ -0,0 +1,44 @@
+package org.eclipse.fx.testcases.l10n.app;
+
+import org.eclipse.fx.core.di.text.AbstractMessageRegistry;
+import org.eclipse.fx.core.text.Formatter;
+
+import org.eclipse.e4.core.di.annotations.Creatable;
+
+import java.util.function.Supplier;
+
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.services.nls.Translation;
+
+@Creatable
+public class BasicMessagesRegistry extends AbstractMessageRegistry<BasicMessages> {
+
+
+
+
+ @Inject
+ public void updateMessages(@Translation BasicMessages messages) {
+ super.updateMessages(messages);
+ }
+
+ public String BasicYes() {
+ return getMessages().BasicYes;
+ }
+
+
+ public String BasicDyn() {
+ return getMessages().BasicDyn;
+ }
+
+ public String BasicDyn(Object val) {
+ java.util.Map<String,Object> dataMap = new java.util.HashMap<>();
+ dataMap.put("val",val);
+ return org.apache.commons.lang.text.StrSubstitutor.replace( BasicDyn(), dataMap);
+ }
+
+ public Supplier<String> BasicDyn_supplier(Object val) {
+ return () -> BasicDyn(val);
+ }
+
+}
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages_de.properties b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages_de.properties
new file mode 100644
index 000000000..4d37412a3
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages_de.properties
@@ -0,0 +1,2 @@
+BasicYes = Ja
+BasicDyn = DE: ${val}
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages_en.properties b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages_en.properties
new file mode 100644
index 000000000..dc9bc55fa
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/BasicMessages_en.properties
@@ -0,0 +1,2 @@
+BasicYes = Yes
+BasicDyn = EN: ${val}
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages.java b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages.java
new file mode 100644
index 000000000..25ea10669
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages.java
@@ -0,0 +1,8 @@
+package org.eclipse.fx.testcases.l10n.app;
+
+public class SamplePartMessages {
+ public String SimpleText;
+ public String SimpleDateText;
+ public String SimpleNumberText;
+ public String CustFormatText;
+}
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages.properties b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages.properties
new file mode 100644
index 000000000..fada4e619
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages.properties
@@ -0,0 +1,4 @@
+SimpleText = Hello World
+SimpleDateText = Hello World on ${now,-date,MMM/dd/yyyy}
+SimpleNumberText = Hello World ${val,-number,#,##0} times
+CustFormatText = Hello World ${val,myformatter,#,##0} times
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessagesRegistry.java b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessagesRegistry.java
new file mode 100644
index 000000000..02cf6ff55
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessagesRegistry.java
@@ -0,0 +1,103 @@
+package org.eclipse.fx.testcases.l10n.app;
+
+import org.eclipse.fx.core.di.text.AbstractMessageRegistry;
+import org.eclipse.fx.core.text.Formatter;
+
+import org.eclipse.e4.core.di.annotations.Creatable;
+
+import java.util.function.Supplier;
+
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.services.nls.Translation;
+
+@Creatable
+public class SamplePartMessagesRegistry extends AbstractMessageRegistry<SamplePartMessages> {
+ @Inject
+ private org.eclipse.fx.core.di.text.NumberFormatter _number;
+
+ @Inject
+ private org.eclipse.fx.core.di.text.DateFormatter _date;
+
+ @Inject
+ private org.eclipse.fx.testcases.l10n.app.MyFormatter cust_myformatter;
+
+ @Inject
+ private org.eclipse.fx.testcases.l10n.app.BasicMessagesRegistry bundle_BasicMessages;
+
+ @Inject
+ public void updateMessages(@Translation SamplePartMessages messages) {
+ super.updateMessages(messages);
+ }
+
+ public String SimpleText() {
+ return getMessages().SimpleText;
+ }
+
+
+ public String SimpleDateText() {
+ return getMessages().SimpleDateText;
+ }
+
+ public String SimpleDateText(java.util.Date now) {
+ java.util.Map<String,Object> dataMap = new java.util.HashMap<>();
+ dataMap.put("now",now);
+ java.util.Map<String,Formatter<?>> formatterMap = new java.util.HashMap<>();
+ formatterMap.put("-date",_date);
+ return org.eclipse.fx.core.text.MessageFormatter.create(dataMap::get,formatterMap::get).apply( SimpleDateText() );
+ }
+
+ public Supplier<String> SimpleDateText_supplier(java.util.Date now) {
+ return () -> SimpleDateText(now);
+ }
+
+ public String SimpleNumberText() {
+ return getMessages().SimpleNumberText;
+ }
+
+ public String SimpleNumberText(Number val) {
+ java.util.Map<String,Object> dataMap = new java.util.HashMap<>();
+ dataMap.put("val",val);
+ java.util.Map<String,Formatter<?>> formatterMap = new java.util.HashMap<>();
+ formatterMap.put("-number",_number);
+ return org.eclipse.fx.core.text.MessageFormatter.create(dataMap::get,formatterMap::get).apply( SimpleNumberText() );
+ }
+
+ public Supplier<String> SimpleNumberText_supplier(Number val) {
+ return () -> SimpleNumberText(val);
+ }
+
+ public String CustFormatText() {
+ return getMessages().CustFormatText;
+ }
+
+ public String CustFormatText(Number val) {
+ java.util.Map<String,Object> dataMap = new java.util.HashMap<>();
+ dataMap.put("val",val);
+ java.util.Map<String,Formatter<?>> formatterMap = new java.util.HashMap<>();
+ formatterMap.put("myformatter",cust_myformatter);
+ return org.eclipse.fx.core.text.MessageFormatter.create(dataMap::get,formatterMap::get).apply( CustFormatText() );
+ }
+
+ public Supplier<String> CustFormatText_supplier(Number val) {
+ return () -> CustFormatText(val);
+ }
+
+ public String ReferenceText() {
+ return bundle_BasicMessages.BasicYes();
+ }
+
+
+ public String ReferenceDyn() {
+ return bundle_BasicMessages.BasicDyn();
+ }
+
+ public String ReferenceDyn(Object val) {
+ return bundle_BasicMessages.BasicDyn(val);
+ }
+
+ public Supplier<String> ReferenceDyn_supplier(Object val) {
+ return () -> ReferenceDyn(val);
+ }
+
+}
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages_de.properties b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages_de.properties
new file mode 100644
index 000000000..c14bb1dcb
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages_de.properties
@@ -0,0 +1,4 @@
+SimpleText = Hallo Welt
+SimpleDateText = Hallo Welt am ${now,-date,dd.MM.yyyy}
+SimpleNumberText = Hallo Welt ${val,-number,#,##0} mal
+CustFormatText = Hallo Welt ${val,myformatter,#,##0} mal
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages_en.properties b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages_en.properties
new file mode 100644
index 000000000..fada4e619
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src-gen/org/eclipse/fx/testcases/l10n/app/SamplePartMessages_en.properties
@@ -0,0 +1,4 @@
+SimpleText = Hello World
+SimpleDateText = Hello World on ${now,-date,MMM/dd/yyyy}
+SimpleNumberText = Hello World ${val,-number,#,##0} times
+CustFormatText = Hello World ${val,myformatter,#,##0} times
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/Message.l10n b/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/Message.l10n
new file mode 100644
index 000000000..8939009f6
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/Message.l10n
@@ -0,0 +1,33 @@
+package org.eclipse.fx.testcases.l10n.app {
+ bundle BasicMessages default en {
+ BasicYes : {
+ en : '''Yes''',
+ de : '''Ja'''
+ }
+ BasicDyn (ANY val) : {
+ en : '''EN: «val»''',
+ de : '''DE: «val»'''
+ }
+ }
+ bundle SamplePartMessages default en {
+ formatter myformatter org.eclipse.fx.testcases.l10n.app.MyFormatter
+ SimpleText : {
+ en : '''Hello World''',
+ de : '''Hallo Welt'''
+ }
+ SimpleDateText (DATE now) : {
+ en : '''Hello World on «now "MMM/dd/yyyy"»''',
+ de : '''Hallo Welt am «now "dd.MM.yyyy"»'''
+ }
+ SimpleNumberText (NUMBER val) : {
+ en : '''Hello World «val "#,##0"» times''',
+ de : '''Hallo Welt «val "#,##0"» mal'''
+ }
+ CustFormatText (NUMBER val) : {
+ en : '''Hello World «val "#,##0" myformatter» times''',
+ de : '''Hallo Welt «val "#,##0" myformatter» mal'''
+ }
+ ReferenceText : [ BasicMessages.BasicYes ]
+ ReferenceDyn (ANY val) : [ BasicMessages.BasicDyn ]
+ }
+} \ No newline at end of file
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/MyFormatter.java b/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/MyFormatter.java
new file mode 100644
index 000000000..e871a7361
--- /dev/null
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/MyFormatter.java
@@ -0,0 +1,19 @@
+package org.eclipse.fx.testcases.l10n.app;
+
+import java.text.DecimalFormat;
+
+import org.eclipse.e4.core.di.annotations.Creatable;
+import org.eclipse.fx.core.text.Formatter;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+
+@Creatable
+public class MyFormatter implements Formatter<Object> {
+
+ @Override
+ public @NonNull String format(@Nullable Object object,
+ @NonNull String format) {
+ return object == null ? "-" : new DecimalFormat(format).format(object);
+ }
+
+}
diff --git a/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/SamplePart.java b/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/SamplePart.java
index ff21d3223..b02039316 100644
--- a/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/SamplePart.java
+++ b/demos/org.eclipse.fx.testcases.l10n.app/src/org/eclipse/fx/testcases/l10n/app/SamplePart.java
@@ -1,13 +1,50 @@
package org.eclipse.fx.testcases.l10n.app;
+import java.util.Date;
+
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
+import javafx.scene.layout.VBox;
import javax.annotation.PostConstruct;
+import javax.inject.Inject;
public class SamplePart {
+ @Inject
+ SamplePartMessagesRegistry r;
+
@PostConstruct
void init(BorderPane parent) {
- parent.setCenter(new Label("Hello World"));
+ VBox b = new VBox();
+
+ {
+ Label label = new Label();
+ r.register(label::setText, r::SimpleText);
+
+ b.getChildren().add(label);
+ }
+
+ {
+ Label label = new Label();
+ r.register(label::setText, r.SimpleDateText_supplier(new Date()));
+
+ b.getChildren().add(label);
+ }
+
+ {
+ Label label = new Label();
+ r.register(label::setText, r.SimpleNumberText_supplier(10_000));
+
+ b.getChildren().add(label);
+ }
+
+ {
+ Label label = new Label();
+ r.register(label::setText, r.CustFormatText_supplier(null));
+
+ b.getChildren().add(label);
+ }
+
+ parent.setTop(b);
}
}

Back to the top