summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-04-30 21:27:05 +0200
committerEike Rathke <erack@redhat.com>2012-04-30 21:27:55 +0200
commit17e6c9b8bf482bc36436c4d8daca994a65ce4634 (patch)
tree5c266ef5ed7501edbb0e5cd2aa23e896a4400538 /i18npool
parent0992e5111fcac424e3b0e944a077716428ab4f84 (diff)
script to list locales with and without DateAcceptancePattern
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/localedata/data/list-dateacceptancepattern.awk121
1 files changed, 121 insertions, 0 deletions
diff --git a/i18npool/source/localedata/data/list-dateacceptancepattern.awk b/i18npool/source/localedata/data/list-dateacceptancepattern.awk
new file mode 100644
index 000000000000..b1ad115e52ca
--- /dev/null
+++ b/i18npool/source/localedata/data/list-dateacceptancepattern.awk
@@ -0,0 +1,121 @@
+#!/usr/bin/gawk -f
+# -*- Mode: awk; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+#
+# Copyright 2012 LibreOffice contributors.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# 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.
+# If --html is given as the last parameter, format output suitable for
+# inclusion in HTML.
+
+BEGIN {
+ html = 0
+ if (ARGV[ARGC-1] == "--html") {
+ html = 1
+ --ARGC
+ }
+ file = ""
+ nopatterns = 0
+ if (html)
+ print "<p>"
+ else
+ print ""
+ print "Locales with explicit DateAcceptancePattern elements:"
+ if (html)
+ print "<ul>"
+}
+
+
+file != FILENAME {
+ if (file)
+ endFile()
+ file = FILENAME
+ patterns = 0
+ noFormatCode = 1
+}
+
+/<DateAcceptancePattern>/ {
+ split( $0, a, /<|>/ )
+ pattern[patterns++] = a[3]
+}
+
+# No FormatCode element means inherited LC_FORMAT ref=...
+# hence pattern inherited as well.
+/<FormatCode>/ {
+ noFormatCode = 0
+}
+
+
+END {
+ if (file)
+ endFile()
+ if (html)
+ {
+ print "</ul>"
+ print "\n<p>"
+ }
+ else
+ print "\n"
+ print "Locales without explicit DateAcceptancePattern elements:"
+ if (html)
+ print "<br>"
+ print "(one implicit full date pattern is always generated)"
+ if (html)
+ print "<p>"
+ if (html)
+ {
+ for (i=0; i<nopatterns; ++i)
+ {
+ print NoPatternList[i] "&nbsp;&nbsp;&nbsp; "
+ }
+ }
+ else
+ {
+ for (i=0; i<nopatterns; ++i)
+ {
+ print NoPatternList[i]
+ }
+ }
+}
+
+
+function endFile() {
+ if (patterns)
+ {
+ if (html)
+ {
+ print " <li> " getLocale( file) ":"
+ print " <ul>"
+ for ( i=0; i<patterns; ++i )
+ {
+ print " <li> " pattern[i]
+ }
+ print " </ul>"
+ }
+ else
+ {
+ print getLocale( file) ":"
+ for ( i=0; i<patterns; ++i )
+ {
+ print " " pattern[i]
+ }
+ }
+ }
+ else if (!noFormatCode)
+ NoPatternList[nopatterns++] = getLocale( file)
+}
+
+
+function getLocale( file, tmp ) {
+ tmp = file
+ gsub( /.*\//, "", tmp )
+ gsub( /\.xml/, "", tmp )
+ return tmp
+}
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab: