Hi Isomorphic,
I'm doing DataSource localization according to this docs.
The links in the docs are outdated or even 404s (links go to non-existent Java 1.4 docs). I found the corresponding Java 7 docs, but can't in no way get the .ds.xml to be localized.
Instead, all field titles are empty. If I look at the DataSourceLoader result directly, I see lines like
I tried setting a higher loglevel for DataSourceLoader and even ResourceBundle and PropertyResourceBundle (result: no additional logs) and also Win8 ProcessMonitor (result: only file access at Tomcat start).
So I'm pretty confused what went wrong.
My .ds.xmls looks like:
My DSXMLResources.java looks like this
I have a DSXMLResources.properties and a DSXMLResources_de.properties and the string createdBy is defined as
I also tried with test files based on the java.com ResourceBundle samples:
I also tried having the files directly under src (resulting in them being directly below classes in the deployed application), Nothing worked.
Could you show some serverside code for this?
My aim (if possible) is to have one .properties file for all .ds.xmls.
If that's not possible, a file per .ds.xml is also OK.
I'm using SNAPSHOT_v10.1d_2015-11-23/PowerEdition, Tomcat 7, Java 7.
Thank you & Best regards
Blama
I'm doing DataSource localization according to this docs.
The links in the docs are outdated or even 404s (links go to non-existent Java 1.4 docs). I found the corresponding Java 7 docs, but can't in no way get the .ds.xml to be localized.
Instead, all field titles are empty. If I look at the DataSourceLoader result directly, I see lines like
Code:
{title:"\n\t\t\t\t<fmt:message key=\"createdBy\" xmlns:fmt=\"WEB-INF/\"/>\n\t\t\t"
So I'm pretty confused what went wrong.
My .ds.xmls looks like:
Code:
<DataSource xmlns:fmt="WEB-INF/" dbName="Oracle" ID="T_USER" serverType="sql" serverConstructor="com.lmscompany.lms.server.LMSSQLDataSource"> [B]<fmt:bundle basename="com.lmscompany.lms.shared.i18n.DSXMLResources" />[/B] <fields> <field primaryKey="true" ... <field foreignKey="V_USER_CREATED_BY.ID" relatedTableAlias="USER_CREATED_BY" name="CREATED_BY" type="creator"> <title> <fmt:message key="createdBy" /> </title> </field>
Code:
[B]package com.lmscompany.lms.shared.i18n;[/B] import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.util.PropertyResourceBundle; public class DSXMLResources extends PropertyResourceBundle { public DSXMLResources(InputStream stream) throws IOException { super(stream); } public DSXMLResources(Reader reader) throws IOException { super(reader); } }
Code:
createdBy = Created by
Code:
package com.lmscompany.lms.shared.i18n; import java.util.Arrays; import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; import java.util.ResourceBundle; import java.util.Set; // default (English language, United States) public class MyResources extends ResourceBundle { public Object handleGetObject(String key) { if (key.equals("leadTemperature")) return "leadTemperature"; if (key.equals("leadType")) return "leadType"; return null; } public Enumeration<String> getKeys() { return Collections.enumeration(keySet()); } // Overrides handleKeySet() so that the getKeys() implementation // can rely on the keySet() value. protected Set<String> handleKeySet() { return new HashSet<String>(Arrays.asList("leadTemperature", "leadType")); } }
Could you show some serverside code for this?
My aim (if possible) is to have one .properties file for all .ds.xmls.
If that's not possible, a file per .ds.xml is also OK.
I'm using SNAPSHOT_v10.1d_2015-11-23/PowerEdition, Tomcat 7, Java 7.
Thank you & Best regards
Blama
Comment