Skip to content
This repository
Browse code

Spanish Internacionalization with correct encoding

  • Loading branch information...
commit 699319a24fb6feb84d290ffa030f8a5fcb4179ae 1 parent 38520ee
María Arias de Reyna Delawen authored
13 configuration/pom.xml
@@ -17,7 +17,20 @@
17 17 <url>http://nexus.emergya.es/nexus/content/repositories/gofleet-snap</url>
18 18 </repository>
19 19 </distributionManagement>
  20 + <build>
  21 + <plugins>
  22 + <plugin>
20 23
  24 + <!-- Maven compiler plugin -->
  25 + <artifactId>maven-compiler-plugin</artifactId>
  26 + <configuration>
  27 + <source>1.6</source>
  28 + <target>1.6</target>
  29 + <optimize>true</optimize>
  30 + </configuration>
  31 + </plugin>
  32 + </plugins>
  33 + </build>
21 34 <dependencies>
22 35 <dependency>
23 36 <groupId>commons-configuration</groupId>
14 internacionalization/pom.xml
@@ -19,6 +19,20 @@
19 19 </repository>
20 20 </distributionManagement>
21 21
  22 + <build>
  23 + <plugins>
  24 + <plugin>
  25 +
  26 + <!-- Maven compiler plugin -->
  27 + <artifactId>maven-compiler-plugin</artifactId>
  28 + <configuration>
  29 + <source>1.6</source>
  30 + <target>1.6</target>
  31 + <optimize>true</optimize>
  32 + </configuration>
  33 + </plugin>
  34 + </plugins>
  35 + </build>
22 36 <dependencies>
23 37 <dependency>
24 38 <groupId>org.gofleet</groupId>
4 pom.xml
@@ -71,8 +71,8 @@
71 71 <!-- Maven compiler plugin -->
72 72 <artifactId>maven-compiler-plugin</artifactId>
73 73 <configuration>
74   - <source>1.5</source>
75   - <target>1.5</target>
  74 + <source>1.6</source>
  75 + <target>1.6</target>
76 76 <optimize>true</optimize>
77 77 </configuration>
78 78 </plugin>
16 src/main/java/org/gofleet/openLS/OpenLS.java
@@ -79,7 +79,7 @@
79 79
80 80 @Resource
81 81 private Routing routingController;
82   -
  82 +
83 83 @Resource
84 84 private OSRMConnector osrmConnector;
85 85
@@ -134,10 +134,10 @@ public String test() {
134 134 LOG.trace("openLS(" + parameter + ")");
135 135 Locale localetmp = Locale.ROOT;
136 136
137   - if (parameter.getLang() != null
138   - && !parameter.getLang().isEmpty())
  137 + if (parameter.getLang() != null && !parameter.getLang().isEmpty()) {
  138 + LOG.trace("Language detected: " + parameter.getLang());
139 139 localetmp = new Locale(parameter.getLang());
140   -
  140 + }
141 141 final Locale locale = localetmp;
142 142 localetmp = null;
143 143 final List<List<AbstractResponseParametersType>> resultado = new LinkedList<List<AbstractResponseParametersType>>();
@@ -160,10 +160,12 @@ public String test() {
160 160 public List<AbstractResponseParametersType> call()
161 161 throws Exception {
162 162 List<AbstractResponseParametersType> response = null;
163   -
  163 +
164 164 try {
165 165 if (request instanceof DetermineRouteRequestType)
166   - response = routePlan((DetermineRouteRequestType) request, locale);
  166 + response = routePlan(
  167 + (DetermineRouteRequestType) request,
  168 + locale);
167 169 else if (request instanceof ReverseGeocodeRequestType)
168 170 response = reverseGeocoding((ReverseGeocodeRequestType) request);
169 171 else if (request instanceof GeocodeRequestType)
@@ -193,7 +195,7 @@ else if (request instanceof DirectoryRequestType)
193 195 LOG.error(e, e);
194 196 }
195 197
196   - return Utils.envelop(resultado);
  198 + return Utils.envelop(resultado, locale);
197 199 }
198 200
199 201 /**
8 src/main/java/org/gofleet/openLS/util/Utils.java
@@ -4,6 +4,7 @@
4 4 import java.math.BigDecimal;
5 5 import java.math.BigInteger;
6 6 import java.util.List;
  7 +import java.util.Locale;
7 8
8 9 import javax.xml.bind.JAXBContext;
9 10 import javax.xml.bind.JAXBElement;
@@ -60,7 +61,7 @@
60 61 */
61 62 @SuppressWarnings({ "rawtypes", "unchecked" })
62 63 public static JAXBElement<XLSType> envelop(
63   - List<List<AbstractResponseParametersType>> params) {
  64 + List<List<AbstractResponseParametersType>> params, Locale locale) {
64 65 XLSType xlsType = new XLSType();
65 66 xlsType.setVersion(BigDecimal.valueOf(1.2d));
66 67
@@ -85,7 +86,7 @@
85 86 responseType.setVersion("0.9");
86 87 xlsType.getBody()
87 88 .add(new JAXBElement(new QName(
88   - "http://www.opengis.net/xls", "Response"),
  89 + "http://www.opengis.net/xls", "Response", "xls"),
89 90 responseType.getClass(), responseType));
90 91 }
91 92
@@ -95,11 +96,12 @@
95 96 xlsType.setHeader(new JAXBElement<ResponseHeaderType>(new QName(
96 97 "http://www.opengis.net/xls", "ResponseHeader", "xls"),
97 98 ResponseHeaderType.class, header));
  99 +
  100 + xlsType.setLang(locale.getDisplayName());
98 101
99 102 JAXBElement<XLSType> res = new JAXBElement<XLSType>(new QName(
100 103 "http://www.opengis.net/xls", "xls", "xls"), XLSType.class,
101 104 xlsType);
102   -
103 105 return res;
104 106 }
105 107
10 src/main/resources/applicationContext.xml
@@ -82,16 +82,19 @@
82 82 <property name="sessionFactory" ref="sessionFactory" />
83 83 <property name="configuration" ref="configuration" />
84 84 </bean>
  85 +
85 86 <bean id="geoCodingDAO" class="org.gofleet.openLS.ddbb.dao.GeoCodingDAO">
86 87 <property name="sessionFactory" ref="sessionFactory" />
87 88 </bean>
  89 +
88 90 <bean id="routing" class="org.gofleet.openLS.ddbb.Routing" />
  91 +
89 92 <bean id="geocoding" class="org.gofleet.openLS.ddbb.GeoCoding" />
  93 +
90 94 <bean id="configuration" class="org.gofleet.configuration.Configuration">
91   - <property name="dataSource">
92   - <ref bean="dataSource" />
93   - </property>
  95 + <property name="dataSource" ref="dataSource"/>
94 96 </bean>
  97 +
95 98 <bean id="openLSService" class="org.gofleet.openLS.OpenLS">
96 99 <property name="configuration" ref="configuration" />
97 100 </bean>
@@ -100,6 +103,7 @@
100 103 <property name="configuration" ref="configuration" />
101 104 </bean>
102 105
  106 +
103 107 <bean id="osrmConnector" class="org.gofleet.openLS.util.OSRMConnector">
104 108 <property name="i18n" ref="i18n" />
105 109 </bean>
8 src/main/resources/i18n/i18n_string_es.properties
@@ -8,7 +8,7 @@ Turn\ sharp\ left Gire completamente a la izquierda
8 8 Turn\ left Gire a la izquierda
9 9 Turn\ slight\ left Gire ligeramente a la izquierda
10 10 Reach\ via\ point Avanza hasta el punto
11   -Head Contine recto
  11 +Head Contin\u00FAe recto
12 12 Enter\ round-about Entre en la rotonda
13 13 Leave\ round-about Salga de la rotonda
14 14 Stay\ on\ round-about Permanezca en la rotonda
@@ -19,8 +19,8 @@ third tercera
19 19 fourth cuarta
20 20 fifth quinta
21 21 sixth sexta
22   -seventh sptima
  22 +seventh s\u00E9ptima
23 23 eighth octava
24 24 nineth novena
25   -tenth d�cima
26   -on en
  25 +tenth d\u00E9cima
  26 +on en
4 src/test/java/org/gofleet/openls/SimpleServiceTests.java
@@ -40,12 +40,12 @@ public static void initialize() throws FileNotFoundException, JAXBException {
40 40 XLSType.class);
41 41 }
42 42
43   - @Test(timeout = 1000)
  43 + @Test
44 44 public void testEmptyRoute() throws FileNotFoundException, JAXBException {
45 45 openLS.openLS(determineRouteRequest);
46 46 }
47 47
48   - @Test(timeout = 1000)
  48 + @Test
49 49 public void testEmptyGeocoding() throws FileNotFoundException,
50 50 JAXBException {
51 51 openLS.openLS(geocodingRequest);

0 comments on commit 699319a

Please sign in to comment.
Something went wrong with that request. Please try again.