[Libreoffice-commits] .: i18npool/source

Eike Rathke erack at kemper.freedesktop.org
Fri Jul 20 14:20:23 PDT 2012


 i18npool/source/localedata/data/list-dateacceptancepattern.awk |   56 ++++++++--
 1 file changed, 45 insertions(+), 11 deletions(-)

New commits:
commit 38feb1ef3840a7c4aa8b70e4d1570675697a53ae
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jul 20 23:19:31 2012 +0200

    include locales inheriting patterns
    
    Change-Id: I06f4578f6d681064a8e41e4bef45a7034b7b5a64

diff --git a/i18npool/source/localedata/data/list-dateacceptancepattern.awk b/i18npool/source/localedata/data/list-dateacceptancepattern.awk
index b1ad115..87ddfdc 100644
--- a/i18npool/source/localedata/data/list-dateacceptancepattern.awk
+++ b/i18npool/source/localedata/data/list-dateacceptancepattern.awk
@@ -8,8 +8,11 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Usage: gawk -f list-dateacceptancepattern.awk *.xml [--html]
-# Outputs two lists of locales, one with DateAcceptancePattern elements
-# defined, and one where none are defined.
+#
+# Outputs three lists of locales, one with DateAcceptancePattern elements
+# defined, one with inherited LC_FORMAT elements and thus date patterns, and
+# one where no DateAcceptancePattern are defined.
+#
 # If --html is given as the last parameter, format output suitable for
 # inclusion in HTML.
 
@@ -21,6 +24,7 @@ BEGIN {
     }
     file = ""
     nopatterns = 0
+    inheritedcount = 0
     if (html)
         print "<p>"
     else
@@ -36,7 +40,7 @@ file != FILENAME {
         endFile()
     file = FILENAME
     patterns = 0
-    noFormatCode = 1
+    inherited = ""
 }
 
 /<DateAcceptancePattern>/ {
@@ -44,10 +48,10 @@ file != FILENAME {
     pattern[patterns++] = a[3]
 }
 
-# No FormatCode element means inherited LC_FORMAT ref=...
-# hence pattern inherited as well.
-/<FormatCode>/ {
-    noFormatCode = 0
+# pattern inherited as well
+/<LC_FORMAT[^>]* ref="[^>"]+"[^>]*>/ {
+    split( $0, a, /.* ref="|"/ )
+    inherited = a[2]
 }
 
 
@@ -61,6 +65,28 @@ END {
     }
     else
         print "\n"
+
+    print "Locales inheriting patterns:"
+    if (html)
+    {
+        print "<br>"
+        for (i=0; i<inheritedcount; ++i)
+        {
+            if (LocaleHasPatterns[InheritedList[i][1]])
+                print InheritedList[i][0] " = " InheritedList[i][1] "    "
+        }
+        print "\n<p>"
+    }
+    else
+    {
+        for (i=0; i<inheritedcount; ++i)
+        {
+            if (LocaleHasPatterns[InheritedList[i][1]])
+                print InheritedList[i][0] " = " InheritedList[i][1]
+        }
+        print "\n"
+    }
+
     print "Locales without explicit DateAcceptancePattern elements:"
     if (html)
         print "<br>"
@@ -85,11 +111,13 @@ END {
 
 
 function endFile() {
+    locale =  getLocale( file)
+    LocaleHasPatterns[locale] = patterns
     if (patterns)
     {
         if (html)
         {
-            print "  <li> " getLocale( file) ":"
+            print "  <li> " locale ":"
             print "  <ul>"
             for ( i=0; i<patterns; ++i )
             {
@@ -99,15 +127,21 @@ function endFile() {
         }
         else
         {
-            print getLocale( file) ":"
+            print locale ":"
             for ( i=0; i<patterns; ++i )
             {
                 print "    " pattern[i]
             }
         }
     }
-    else if (!noFormatCode)
-        NoPatternList[nopatterns++] = getLocale( file)
+    else if (inherited)
+    {
+        InheritedList[inheritedcount][0] = locale
+        InheritedList[inheritedcount][1] = inherited
+        ++inheritedcount
+    }
+    else
+        NoPatternList[nopatterns++] = locale
 }
 
 


More information about the Libreoffice-commits mailing list