[tomcat] branch 8.5.x updated: Remove translated values for keys that have been removed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch 8.5.x updated: Remove translated values for keys that have been removed

markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 2f02d53  Remove translated values for keys that have been removed
2f02d53 is described below

commit 2f02d535aec15ed33e042a16ace06aab05315911
Author: Mark Thomas <[hidden email]>
AuthorDate: Wed Sep 11 15:16:19 2019 +0100

    Remove translated values for keys that have been removed
---
 .../tomcat/buildutil/translate/BackportTranslations.java       | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/java/org/apache/tomcat/buildutil/translate/BackportTranslations.java b/java/org/apache/tomcat/buildutil/translate/BackportTranslations.java
index 6c27177..25c2d75 100644
--- a/java/org/apache/tomcat/buildutil/translate/BackportTranslations.java
+++ b/java/org/apache/tomcat/buildutil/translate/BackportTranslations.java
@@ -17,6 +17,8 @@
 package org.apache.tomcat.buildutil.translate;
 
 import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
 import java.util.Properties;
 
 /**
@@ -60,6 +62,14 @@ public class BackportTranslations extends BackportBase {
                 }
             }
 
+            // Remove translated values for keys that have been removed
+            Iterator<Map.Entry<Object,Object>> iter = targetTranslated.entrySet().iterator();
+            while (iter.hasNext()) {
+                Map.Entry<Object,Object> entry = iter.next();
+                if (!targetEnglish.containsKey(entry.getKey())) {
+                    iter.remove();
+                }
+            }
             Utils.export(langauge, targetTranslated, storageDir);
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]