You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/05/25 21:03:40 UTC
[tomcat] branch main updated (7929f10 -> 1bd131c)
This is an automated email from the ASF dual-hosted git repository.
markt pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git.
from 7929f10 AprLifecycleListener does not show dev version suffix for libtcnative and libapr
new de456f5 Align with other languages
new 3199da4 Update import/export to handle POEditor behaviours
new 1bd131c Add a couple of French translations
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../jasper/resources/LocalStrings_fr.properties | 2 +
.../jasper/resources/LocalStrings_ja.properties | 4 --
.../jasper/resources/LocalStrings_ko.properties | 4 --
.../apache/tomcat/buildutil/translate/Import.java | 2 +-
.../apache/tomcat/buildutil/translate/Utils.java | 53 ++++++++++++++++------
.../tomcat/buildutil/translate/TestUtils.java | 39 ++++++++++++++--
6 files changed, 77 insertions(+), 27 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 02/03: Update import/export to handle POEditor behaviours
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 3199da4a8ba72112d882a9f23d65953d1954606b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 25 22:02:42 2021 +0100
Update import/export to handle POEditor behaviours
The end results for
Tomcat-Export->Tomcat-Import
and
Tomcat-Export->POEditor-Import->POEditor-Export->Tomcat-Import
are now much more similar
---
.../apache/tomcat/buildutil/translate/Import.java | 2 +-
.../apache/tomcat/buildutil/translate/Utils.java | 53 ++++++++++++++++------
.../tomcat/buildutil/translate/TestUtils.java | 39 ++++++++++++++--
3 files changed, 75 insertions(+), 19 deletions(-)
diff --git a/java/org/apache/tomcat/buildutil/translate/Import.java b/java/org/apache/tomcat/buildutil/translate/Import.java
index ae40353..e1fe9a3 100644
--- a/java/org/apache/tomcat/buildutil/translate/Import.java
+++ b/java/org/apache/tomcat/buildutil/translate/Import.java
@@ -82,7 +82,7 @@ public class Import {
w.write(System.lineSeparator());
}
- w.write(cKey.key + "=" + Utils.formatValue(value));
+ w.write(cKey.key + "=" + Utils.formatValueImport(value));
w.write(System.lineSeparator());
}
if (w != null) {
diff --git a/java/org/apache/tomcat/buildutil/translate/Utils.java b/java/org/apache/tomcat/buildutil/translate/Utils.java
index 326d7fc..4550448 100644
--- a/java/org/apache/tomcat/buildutil/translate/Utils.java
+++ b/java/org/apache/tomcat/buildutil/translate/Utils.java
@@ -32,9 +32,10 @@ import java.util.regex.Pattern;
public class Utils {
- private static final Pattern ADD_CONTINUATION = Pattern.compile("\\n", Pattern.MULTILINE);
private static final Pattern ESCAPE_LEADING_SPACE = Pattern.compile("^(\\s)", Pattern.MULTILINE);
- private static final Pattern FIX_SINGLE_QUOTE = Pattern.compile("(?<!')'(?!')", Pattern.MULTILINE);
+
+ // Package private so it is visible to tests
+ static final String PADDING = "POEDITOR_EXPORT_PADDING_DO_NOT_DELETE";
private Utils() {
// Utility class. Hide default constructor.
@@ -59,21 +60,47 @@ public class Utils {
}
- static String formatValue(String in) {
- String result = ADD_CONTINUATION.matcher(in).replaceAll("\\\\n\\\\\n");
- if (result.endsWith("\\\n")) {
- result = result.substring(0, result.length() - 2);
+ static String formatValueExport(String in) {
+ String result;
+
+ if (in.startsWith("\n")) {
+ result = PADDING + in;
+ } else {
+ result = in;
}
- result = ESCAPE_LEADING_SPACE.matcher(result).replaceAll("\\\\$1");
- if (result.contains("\n\\\t")) {
- result = result.replace("\n\\\t", "\n\\t");
+ return formatValueCommon(result);
+ }
+
+
+ static String formatValueImport(String in) {
+ String result;
+
+ if (in.startsWith(PADDING)) {
+ result = in.substring(PADDING.length());
+ } else {
+ result = in;
}
- if (result.contains("[{0}]")) {
- result = FIX_SINGLE_QUOTE.matcher(result).replaceAll("''");
+ return formatValueCommon(result);
+ }
+
+
+ /*
+ * Common formatting to convert a String for storage as a value in a
+ * property file.
+ */
+ static String formatValueCommon(String in) {
+ String result = in.replace("\n", "\\n\\\n");
+ if (result.endsWith("\\n\\\n")) {
+ result = result.substring(0, result.length() - 2);
}
- return result.trim();
+
+ result = ESCAPE_LEADING_SPACE.matcher(result).replaceAll("\\\\$1");
+
+ result = result.replaceAll("\t", "\\t");
+
+ return result;
}
@@ -143,7 +170,7 @@ public class Utils {
String[] keys = translation.keySet().toArray(new String[0]);
Arrays.sort(keys);
for (Object key : keys) {
- w.write(key + "=" + Utils.formatValue(translation.getProperty((String) key)) + "\n");
+ w.write(key + "=" + Utils.formatValueExport(translation.getProperty((String) key)) + "\n");
}
} catch (IOException ioe) {
ioe.printStackTrace();
diff --git a/test/org/apache/tomcat/buildutil/translate/TestUtils.java b/test/org/apache/tomcat/buildutil/translate/TestUtils.java
index 533ed95..f8a20f1 100644
--- a/test/org/apache/tomcat/buildutil/translate/TestUtils.java
+++ b/test/org/apache/tomcat/buildutil/translate/TestUtils.java
@@ -23,28 +23,57 @@ public class TestUtils {
@Test
public void testQuoteReplacement01() {
- Assert.assertEquals("[{0}] a''a", Utils.formatValue("[{0}] a'a"));
+ Assert.assertEquals("[{0}] a''a", Utils.formatValueImport("[{0}] a'a"));
}
@Test
public void testQuoteReplacement02() {
- Assert.assertEquals("[{0}] a''", Utils.formatValue("[{0}] a'"));
+ Assert.assertEquals("[{0}] a''", Utils.formatValueImport("[{0}] a'"));
}
@Test
public void testQuoteReplacement03() {
- Assert.assertEquals("''a [{0}]", Utils.formatValue("'a [{0}]"));
+ Assert.assertEquals("''a [{0}]", Utils.formatValueImport("'a [{0}]"));
}
@Test
public void testQuoteReplacement05() {
- Assert.assertEquals("[{0}] ''a'' bbb", Utils.formatValue("[{0}] 'a' bbb"));
+ Assert.assertEquals("[{0}] ''a'' bbb", Utils.formatValueImport("[{0}] 'a' bbb"));
}
@Test
public void testQuoteReplacement06() {
- Assert.assertEquals("[{0}] ''aa'' bbb", Utils.formatValue("[{0}] 'aa' bbb"));
+ Assert.assertEquals("[{0}] ''aa'' bbb", Utils.formatValueImport("[{0}] 'aa' bbb"));
}
+ @Test
+ public void testFormatValue01() {
+ // Import from Tomcat
+ Assert.assertEquals("\\n\\\n</web-fragment>\\n", Utils.formatValueImport("\\n\\\n</web-fragment>\\n"));
+ }
+
+ @Test
+ public void testFormatValue02() {
+ // Import from POEditor
+ Assert.assertEquals("\\n\\\n</web-fragment>\\n", Utils.formatValueImport("\\n</web-fragment>\\n"));
+ }
+
+ @Test
+ public void testFormatValue03() {
+ // Export from Tomcat
+ Assert.assertEquals("line1\\n\\\nline2\\n\\\nline3", Utils.formatValueExport("line1\nline2\nline3"));
+ }
+
+ @Test
+ public void testFormatValue04() {
+ // Export from Tomcat
+ Assert.assertEquals(Utils.PADDING + "\\n\\\nline2\\n\\\nline3", Utils.formatValueExport("\nline2\nline3"));
+ }
+
+ @Test
+ public void testFormatValue05() {
+ // Export from Tomcat
+ Assert.assertEquals("line1\\n\\\n\\tline2\\n\\\n\\tline3", Utils.formatValueExport("line1\n\tline2\n\tline3"));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 01/03: Align with other languages
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit de456f50c85e7952275802863b2f9f61b949f9b0
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 25 20:44:40 2021 +0100
Align with other languages
---
java/org/apache/jasper/resources/LocalStrings_ja.properties | 4 ----
java/org/apache/jasper/resources/LocalStrings_ko.properties | 4 ----
2 files changed, 8 deletions(-)
diff --git a/java/org/apache/jasper/resources/LocalStrings_ja.properties b/java/org/apache/jasper/resources/LocalStrings_ja.properties
index 3990cf5..25dbe0a 100644
--- a/java/org/apache/jasper/resources/LocalStrings_ja.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_ja.properties
@@ -372,18 +372,15 @@ jspc.webfrg.header=<?xml version="1.0" encoding="{0}"?>\n\
<!--\n\
Apache Tomcat JspC による自動生成\n\
-->\n\
-\n\
\n
jspc.webinc.footer=<!--\n\
ここまで、Apache Tomcat JspC による自動生成\n\
-->\n\
-\n\
\n
jspc.webinc.header=\n\
<!--\n\
Apache Tomcat JspC による自動生成\n\
-->\n\
-\n\
\n
jspc.webinc.insertEnd=<!-- JSPC サーブレットマッピング ここまで -->
jspc.webinc.insertStart=<!-- JSPC サーブレットマッピング ここから -->
@@ -400,7 +397,6 @@ jspc.webxml.header=<?xml version="1.0" encoding="{0}"?>\n\
<!--\n\
Apache Tomcat JspC による自動生成\n\
-->\n\
-\n\
\n
jstl.OSAfterWriter=Writer が使用されている場合は出力ストリームを使用できません。
diff --git a/java/org/apache/jasper/resources/LocalStrings_ko.properties b/java/org/apache/jasper/resources/LocalStrings_ko.properties
index fba9176..44f4893 100644
--- a/java/org/apache/jasper/resources/LocalStrings_ko.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_ko.properties
@@ -374,18 +374,15 @@ jspc.webfrg.header=<?xml version="1.0" encoding="{0}"?>\n\
<!--\n\
Automatically created by Apache Tomcat JspC.\n\
-->\n\
-\n\
\n
jspc.webinc.footer=<!--\n\
End of content automatically created by Apache Tomcat JspC.\n\
-->\n\
-\n\
\n
jspc.webinc.header=\n\
<!--\n\
Automatically created by Apache Tomcat JspC.\n\
-->\n\
-\n\
\n
jspc.webinc.insertEnd=<!-- JSPC servlet mappings end -->
jspc.webinc.insertStart=<!-- JSPC servlet mappings start -->
@@ -402,7 +399,6 @@ jspc.webxml.header=<?xml version="1.0" encoding="{0}"?>\n\
<!--\n\
Automatically created by Apache Tomcat JspC.\n\
-->\n\
-\n\
\n
jstl.OSAfterWriter=만일 writer가 이미 사용된 경우에는, 출력 스트림을 사용할 수 없습니다.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 03/03: Add a couple of French translations
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 1bd131c126bb60b29cb677d3d107e3bb68c0a64a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 25 22:02:53 2021 +0100
Add a couple of French translations
---
java/org/apache/jasper/resources/LocalStrings_fr.properties | 2 ++
1 file changed, 2 insertions(+)
diff --git a/java/org/apache/jasper/resources/LocalStrings_fr.properties b/java/org/apache/jasper/resources/LocalStrings_fr.properties
index 4329375..19dd49f 100644
--- a/java/org/apache/jasper/resources/LocalStrings_fr.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_fr.properties
@@ -197,6 +197,7 @@ jsp.error.simpletag.badbodycontent=La TLD de la classe [{0}] spécifie un body-c
jsp.error.single.line.number=Une erreur s''est produite à la ligne : [{0}] dans le fichier jsp : [{1}]
jsp.error.stream.close.failed=Erreur à la fermeture du flux
jsp.error.stream.closed=Flux fermé
+jsp.error.string_interpreter_class.instantiation=Impossible de charger ou d''instancier la classe du StringInterpreter [{0}]
jsp.error.tag.conflict.attr=Directive de tag : il est illégal d''avoir plusieurs occurrences de l''attribut [{0}] avec des valeurs différentes (ancienne : [{1}], nouvelle [{2}])
jsp.error.tag.conflict.deferredsyntaxallowedasliteral=Directive de tag : il est illégal d''avoir plusieurs occurrences de "deferredSyntaxAllowedAsLiteral" avec des valeurs différentes (ancienne : [{0}], nouvelle [{1}])
jsp.error.tag.conflict.iselignored=Directive de tag : il est illégal d''avoir plusieurs occurrences de "isELIgnored" avec des valeurs différentes (ancienne : [{0}], nouvelle [{1}])
@@ -300,6 +301,7 @@ jsp.warning.strictWhitespace=WARNING : Valeur invalide pour le paramètre d'init
jsp.warning.suppressSmap=WARNING : valeur invalide d' l'initParam suppressSmap. La valeur par défaut "false" sera utilisée
jsp.warning.tagPreDestroy=Erreur lors du traitement de preDestroy pour l''instance de tag [{0}]
jsp.warning.tagRelease=Erreur lors du traitement de release pour l''instance de tag [{0}]
+jsp.warning.trimspaces=WARNING : Valeur invalide pour le paramètre d'initialisation trimSpaces, la valeur par défaut "false" sera utilisée
jsp.warning.unknown.sourceVM=La VM source [{0}] inconnue a été ignorée
jsp.warning.unknown.targetVM=La VM cible [{0}] inconnue a été ignorée
jsp.warning.unsupported.sourceVM=La VM source [{0}] demandée n''est pas supportée, [{1}] sera utilisé
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org