Skip to content

Commit 7b8ca15

Browse files
committed
Updated localization
1 parent 67b6ad6 commit 7b8ca15

7 files changed

Lines changed: 405 additions & 170 deletions

File tree

i18n/XMLJava_es.tmx

Lines changed: 161 additions & 73 deletions
Large diffs are not rendered by default.

i18n/XMLJava_es.xlf

Lines changed: 211 additions & 85 deletions
Large diffs are not rendered by default.

lib/xmljava.jar

368 Bytes
Binary file not shown.

src/com/maxprograms/xml/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
public class Constants {
1616

1717
public static final String VERSION = "2.2.0";
18-
public static final String BUILD = "20250227_1029";
18+
public static final String BUILD = "20250520_1057";
1919

2020
private Constants() {
2121
// private for security

src/com/maxprograms/xml/ContentModel.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
package com.maxprograms.xml;
1313

1414
import java.io.Serializable;
15+
import java.text.MessageFormat;
1516
import java.util.List;
1617
import java.util.Stack;
1718
import java.util.StringTokenizer;
@@ -65,7 +66,8 @@ public static ContentModel parse(String modelString) {
6566
if (string.startsWith("(#PCDATA")) {
6667
type = MIXED;
6768
if (!string.endsWith(")*")) {
68-
throw new IllegalArgumentException("Invalid mixed content model: " + string);
69+
MessageFormat mf = new MessageFormat(Messages.getString("ContentModel.0"));
70+
throw new IllegalArgumentException(mf.format(new Object[] { modelString }));
6971
}
7072
}
7173

@@ -87,13 +89,13 @@ public static ContentModel parse(String modelString) {
8789
current.add(groupParticle);
8890
} else if ("*".equals(token) || "+".equals(token) || "?".equals(token)) {
8991
if (current.isEmpty()) {
90-
throw new IllegalArgumentException(
91-
"Cardinality operator '" + token + "' must follow a valid particle.");
92+
MessageFormat mf = new MessageFormat(Messages.getString("ContentModel.1"));
93+
throw new IllegalArgumentException(mf.format(new Object[] { token }));
9294
}
9395
Object lastObject = current.get(current.size() - 1);
9496
if (!(lastObject instanceof ContentParticle)) {
95-
throw new IllegalArgumentException(
96-
"Cardinality operator '" + token + "' must follow a valid particle.");
97+
MessageFormat mf = new MessageFormat(Messages.getString("ContentModel.1"));
98+
throw new IllegalArgumentException(mf.format(new Object[] { token }));
9799
}
98100
int cardinality = "?".equals(token) ? OPTIONAL : ("*".equals(token) ? ZEROMANY : ONEMANY);
99101
((ContentParticle) lastObject).setCardinality(cardinality);
@@ -108,7 +110,8 @@ public static ContentModel parse(String modelString) {
108110

109111
for (Object obj : current) {
110112
if (!(obj instanceof ContentParticle)) {
111-
throw new IllegalArgumentException("Invalid content model: " + string);
113+
MessageFormat mf = new MessageFormat(Messages.getString("ContentModel.2"));
114+
throw new IllegalArgumentException(mf.format(new Object[] { modelString }));
112115
}
113116
particles.add((ContentParticle) obj);
114117
}
@@ -118,7 +121,7 @@ public static ContentModel parse(String modelString) {
118121

119122
private static ContentParticle processGroup(List<Object> group) {
120123
if (group.isEmpty()) {
121-
throw new IllegalArgumentException("Empty group found in content model.");
124+
throw new IllegalArgumentException(Messages.getString("ContentModel.3"));
122125
}
123126
if (group.size() == 1) {
124127
Object obj = group.get(0);
@@ -139,7 +142,8 @@ private static ContentParticle processGroup(List<Object> group) {
139142
}
140143
}
141144
if (sep == null) {
142-
throw new IllegalArgumentException("No separator found in group: " + group);
145+
MessageFormat mf = new MessageFormat(Messages.getString("ContentModel.4"));
146+
throw new IllegalArgumentException(mf.format(new Object[] { group }));
143147
}
144148
ContentParticle result = "|".equals(sep) ? new DTDChoice() : new DTDSecuence();
145149
for (Object obj : group) {
@@ -163,17 +167,20 @@ private static void validateParentheses(String string) {
163167
else if (c == ')')
164168
balance--;
165169
if (balance < 0) {
166-
throw new IllegalArgumentException("Unbalanced parentheses in content model: " + string);
170+
MessageFormat mf = new MessageFormat(Messages.getString("ContentModel.5"));
171+
throw new IllegalArgumentException(mf.format(new Object[] { string }));
167172
}
168173
}
169174
if (balance != 0) {
170-
throw new IllegalArgumentException("Unbalanced parentheses in content model: " + string);
175+
MessageFormat mf = new MessageFormat(Messages.getString("ContentModel.5"));
176+
throw new IllegalArgumentException(mf.format(new Object[] { string }));
171177
}
172178
}
173179

174180
private static void validateToken(String token) {
175181
if (!token.matches("[a-zA-Z0-9#|,?*+()]+")) {
176-
throw new IllegalArgumentException("Invalid token in content model: " + token);
182+
MessageFormat mf = new MessageFormat(Messages.getString("ContentModel.6"));
183+
throw new IllegalArgumentException(mf.format(new Object[] { token }));
177184
}
178185
}
179186

src/com/maxprograms/xml/xmljava.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ Catalog.0=Error parsing DTD ''{0}''
22
Calatalog.1=Error connecting to ''{0}'': {1}
33
Calatalog.2=Error {0} for: {1}
44
Catalog.3=Resolving from URL ''{0}''
5+
ContentModel.0=Invalid mixed content model: {0}
6+
ContentModel.1=Cardinality operator ''{0}'' must follow a valid particle
7+
ContentModel.2=Invalid content model: {0}
8+
ContentModel.3=Empty group found in content model
9+
ContentModel.4=No separator found in group: {0}
10+
ContentModel.5=Unbalanced parentheses in content model: {0}
11+
ContentModel.6=Invalid token in content model: {0}
512
CustomContentHandler.0=Malformed content found
613
Document.0=Prolog contains wrong content type
714
DTDParser.0=Malformed entity reference

src/com/maxprograms/xml/xmljava_es.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ Catalog.0=Error al analizar DTD ''{0}''
22
Calatalog.1=Error conectando a ''{0}'': {1}
33
Calatalog.2=Error {0} para: {1}
44
Catalog.3=Resolviendo desde URL ''{0}''
5+
ContentModel.0=Modelo de contenido mixto no válido: {0}
6+
ContentModel.1=El operador de cardinalidad ''{0}'' debe aparecer después de una partícula válida.
7+
ContentModel.2=Modelo de contenido no válido: {0}
8+
ContentModel.3=Se encontró un grupo vacío en el modelo de contenido
9+
ContentModel.4=No se encontró separador en el grupo: {0}
10+
ContentModel.5=Paréntesis desequilibrados en el modelo de contenido: {0}
11+
ContentModel.6=Token no válido en el modelo de contenido: {0}
512
CustomContentHandler.0=Se ha encontrado contenido con formato incorrecto
613
Document.0=Prólogo contiene un tipo de contenido incorrecto
714
DTDParser.0=Referencia de entidad con formato incorrecto

0 commit comments

Comments
 (0)