User:Mike Dillon/timezones

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This list includes all of the long and short timezone names that are known by Java 1.6.0_03, generated with a Groovy script. Some of the country codes in the locales are arbitrary, but if the JDK had different data for the same language in a different locale, then this output would include it (so I think most of the output is not country-specific).

Code[edit]

#!/usr/bin/env groovy

def tzs = TimeZone.availableIDs.collect { TimeZone.getTimeZone(it) }

def locales = [ Locale.ENGLISH ]
locales.addAll(Locale.getAvailableLocales().toList().sort { a, b ->
    def cmp = a.language <=> b.language
    if (cmp == 0) cmp = a.country <=> b.country
    if (cmp == 0) cmp = a.variant <=> b.variant
    return cmp
})

println "== Results =="
println ""

def allNames = [] as Set
locales.eachWithIndex { locale, i ->
    def names = [] as SortedSet
    tzs.each { tz ->
        [ TimeZone.SHORT, TimeZone.LONG ].each { style ->
            names << tz.getDisplayName(false, style, locale)
            if (tz.useDaylightTime()) {
                names << tz.getDisplayName(true, style, locale)
            }
        }
    }

    names.removeAll(allNames)

    if (names) {
        if (i > 0) println ""

        println "=== ${locale.getDisplayName(Locale.ENGLISH)} ($locale) ==="
        println ""

        def mid = Math.ceil(names.size() / 2).toInteger()
        names.eachWithIndex { name, j ->
            if (j == 0) println "{{top2}}"
            if (j == mid) println "{{mid2}}"
            println "* [[$name]]"
            if (j == names.size() - 1) println "{{bottom}}"
        }

        allNames.addAll(names)
    }
}

Results[edit]

English (en)[edit]

German (de)[edit]

Spanish (es)[edit]

French (fr)[edit]

Hindi (India) (hi_IN)[edit]

Italian (it)[edit]

Japanese (ja)[edit]

Korean (ko)[edit]

Swedish (sv)[edit]

Chinese (China) (zh_CN)[edit]

Chinese (Hong Kong) (zh_HK)[edit]