Back to index

plone3  3.1.7
cctld.py
Go to the documentation of this file.
00001 # This file contains a map from internet top level domains to the spoken
00002 # language(s) in the country associated with the domain.
00003 
00004 # Top level domain list taken from http://data.iana.org/TLD/tlds-alpha-by-domain.txt
00005 # Descriptions for most TLDs a can be found at http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
00006 
00007 from plone.i18n.locales.interfaces import ICcTLDInformation
00008 from zope.interface import implements
00009 
00010 
00011 class CcTLDInformation(object):
00012     """A list of country code top level domains their relevant languages.
00013 
00014     Let's make sure that this implementation actually fulfills the API.
00015 
00016       >>> from zope.interface.verify import verifyClass
00017       >>> verifyClass(ICcTLDInformation, CcTLDInformation)
00018       True
00019     """
00020 
00021     implements(ICcTLDInformation)
00022 
00023     def getAvailableTLDs(self):
00024         """Return a sequence of country code top level domains.
00025         """
00026         return _tld_to_language.keys()
00027 
00028     def getTLDs(self):
00029         """Return a sequence of ccTLDs and their languages.
00030         """
00031         return _tld_to_language.copy()
00032 
00033     def getLanguagesForTLD(self, tld):
00034         """Return the relevant languages for a top level domain.
00035         """
00036         return _tld_to_language[tld]
00037 
00038 ccTLDInformation = CcTLDInformation()
00039 
00040 _tld_to_language = {
00041     u"ac"        : [],
00042     u"ad"        : [],
00043     u"ae"        : [],
00044     u"aero"      : [],
00045     u"af"        : [],
00046     u"ag"        : [],
00047     u"ai"        : [],
00048     u"al"        : [],
00049     u"am"        : [],
00050     u"an"        : [],
00051     u"ao"        : [],
00052     u"aq"        : [u"en"],
00053     u"ar"        : [u"pt"],
00054     u"arpa"      : [u"en"],
00055     u"as"        : [u"en"],
00056     u"at"        : [u"de"],
00057     u"au"        : [u"en"],
00058     u"aw"        : [],
00059     u"ax"        : [],
00060     u"az"        : [],
00061     u"ba"        : [u"bs"],
00062     u"bb"        : [],
00063     u"bd"        : [],
00064     u"be"        : [u"nl", u"fr"],
00065     u"bf"        : [],
00066     u"bg"        : [],
00067     u"bh"        : [],
00068     u"bi"        : [],
00069     u"biz"       : [],
00070     u"bj"        : [],
00071     u"bm"        : [],
00072     u"bn"        : [],
00073     u"bo"        : [],
00074     u"br"        : [u"pt"],
00075     u"bs"        : [],
00076     u"bt"        : [],
00077     u"bv"        : [],
00078     u"bw"        : [],
00079     u"by"        : [],
00080     u"bz"        : [],
00081     u"ca"        : [u"en"],
00082     u"cat"       : [u"ca"],
00083     u"cc"        : [],
00084     u"cd"        : [],
00085     u"cf"        : [],
00086     u"cg"        : [],
00087     u"ch"        : [u"de"],
00088     u"ci"        : [],
00089     u"ck"        : [],
00090     u"cl"        : [],
00091     u"cm"        : [],
00092     u"cn"        : [u"zh"],
00093     u"co"        : [],
00094     u"com"       : [],
00095     u"coop"      : [],
00096     u"cr"        : [u"es"],
00097     u"cu"        : [],
00098     u"cv"        : [],
00099     u"cx"        : [],
00100     u"cy"        : [],
00101     u"cz"        : [],
00102     u"de"        : [u"de"],
00103     u"dj"        : [],
00104     u"dk"        : [u"da"],
00105     u"dm"        : [],
00106     u"do"        : [],
00107     u"dz"        : [],
00108     u"ec"        : [],
00109     u"edu"       : [u"en"],
00110     u"ee"        : [u"et"],
00111     u"eg"        : [],
00112     u"er"        : [],
00113     u"es"        : [u"es"],
00114     u"et"        : [],
00115     u"eu"        : [],
00116     u"fi"        : [u"fi"],
00117     u"fj"        : [],
00118     u"fk"        : [],
00119     u"fm"        : [],
00120     u"fo"        : [u"fo"],
00121     u"fr"        : [u"fr"],
00122     u"ga"        : [],
00123     u"gb"        : [u"en"],
00124     u"gd"        : [],
00125     u"ge"        : [u"ka"],
00126     u"gf"        : [],
00127     u"gg"        : [],
00128     u"gh"        : [],
00129     u"gi"        : [],
00130     u"gl"        : [],
00131     u"gm"        : [],
00132     u"gn"        : [],
00133     u"gov"       : [u"en"],
00134     u"gp"        : [],
00135     u"gq"        : [],
00136     u"gr"        : [u"gr"],
00137     u"gs"        : [],
00138     u"gt"        : [],
00139     u"gu"        : [],
00140     u"gw"        : [],
00141     u"gy"        : [],
00142     u"hk"        : [],
00143     u"hm"        : [],
00144     u"hn"        : [],
00145     u"hr"        : [u"hr"],
00146     u"ht"        : [],
00147     u"hu"        : [u"hu"],
00148     u"id"        : [],
00149     u"ie"        : [],
00150     u"il"        : [u"he"],
00151     u"im"        : [u"en"],
00152     u"in"        : [u"hi"],
00153     u"info"      : [],
00154     u"int"       : [],
00155     u"io"        : [u"en"],
00156     u"iq"        : [u"ar"],
00157     u"ir"        : [u"ar"],
00158     u"is"        : [u"is"],
00159     u"it"        : [u"it"],
00160     u"je"        : [u"en"],
00161     u"jm"        : [],
00162     u"jo"        : [],
00163     u"jobs"      : [],
00164     u"jp"        : [u"ja"],
00165     u"ke"        : [],
00166     u"kg"        : [],
00167     u"kh"        : [],
00168     u"ki"        : [],
00169     u"km"        : [],
00170     u"kn"        : [],
00171     u"kr"        : [u"ko"],
00172     u"kw"        : [],
00173     u"ky"        : [],
00174     u"kz"        : [u"kk"],
00175     u"la"        : [],
00176     u"lb"        : [],
00177     u"lc"        : [],
00178     u"li"        : [],
00179     u"lk"        : [],
00180     u"lr"        : [],
00181     u"ls"        : [],
00182     u"lt"        : [],
00183     u"lu"        : [u"lb"],
00184     u"lv"        : [u"lv"],
00185     u"ly"        : [],
00186     u"ma"        : [],
00187     u"mc"        : [],
00188     u"md"        : [u"mo"],
00189     u"mg"        : [u"mg"],
00190     u"mh"        : [],
00191     u"mil"       : [u"en"],
00192     u"mk"        : [],
00193     u"ml"        : [],
00194     u"mm"        : [],
00195     u"mn"        : [u"mn"],
00196     u"mo"        : [],
00197     u"mobi"      : [],
00198     u"mp"        : [],
00199     u"mq"        : [],
00200     u"mr"        : [],
00201     u"ms"        : [],
00202     u"mt"        : [u"mt"],
00203     u"mu"        : [],
00204     u"museum"    : [],
00205     u"mv"        : [],
00206     u"mw"        : [],
00207     u"mx"        : [],
00208     u"my"        : [],
00209     u"mz"        : [],
00210     u"na"        : [],
00211     u"name"      : [],
00212     u"nc"        : [],
00213     u"ne"        : [],
00214     u"net"       : [],
00215     u"nf"        : [],
00216     u"ng"        : [],
00217     u"ni"        : [],
00218     u"nl"        : [u"nl"],
00219     u"no"        : [u"no"],
00220     u"np"        : [],
00221     u"nr"        : [],
00222     u"nu"        : [],
00223     u"nz"        : [],
00224     u"om"        : [u"en"],
00225     u"org"       : [],
00226     u"pa"        : [],
00227     u"pe"        : [],
00228     u"pf"        : [],
00229     u"pg"        : [],
00230     u"ph"        : [],
00231     u"pk"        : [],
00232     u"pl"        : [u"pl"],
00233     u"pm"        : [],
00234     u"pn"        : [],
00235     u"pr"        : [u"es"],
00236     u"pro"       : [],
00237     u"ps"        : [u"ar"],
00238     u"pt"        : [u"pt"],
00239     u"pw"        : [],
00240     u"py"        : [],
00241     u"qa"        : [],
00242     u"re"        : [],
00243     u"ro"        : [],
00244     u"ru"        : [u"ru"],
00245     u"rw"        : [],
00246     u"sa"        : [u"ar"],
00247     u"sb"        : [],
00248     u"sc"        : [],
00249     u"sd"        : [u"su"],
00250     u"se"        : [u"sv"],
00251     u"sg"        : [u"si"],
00252     u"sh"        : [],
00253     u"si"        : [u"sl"],
00254     u"sj"        : [],
00255     u"sk"        : [u"sk"],
00256     u"sl"        : [],
00257     u"sm"        : [],
00258     u"sn"        : [u"fr"],
00259     u"so"        : [u"so"],
00260     u"sr"        : [u"nl"],
00261     u"st"        : [],
00262     u"su"        : [u"ru"],
00263     u"sv"        : [],
00264     u"sy"        : [],
00265     u"sz"        : [],
00266     u"tc"        : [u"tr"],
00267     u"td"        : [],
00268     u"tel"       : [],
00269     u"tf"        : [],
00270     u"tg"        : [u"to"],
00271     u"th"        : [u"th"],
00272     u"tj"        : [u"fa"],
00273     u"tk"        : [u"tk"],
00274     u"tl"        : [u"pt"],
00275     u"tm"        : [u"tk"],
00276     u"tn"        : [],
00277     u"to"        : [],
00278     u"tp"        : [u"pt"],
00279     u"tr"        : [],
00280     u"travel"    : [],
00281     u"tt"        : [],
00282     u"tv"        : [],
00283     u"tw"        : [u"zh"],
00284     u"tz"        : [],
00285     u"ua"        : [],
00286     u"ug"        : [],
00287     u"uk"        : [u"en"],
00288     u"um"        : [u"en"],
00289     u"us"        : [u"en"],
00290     u"uy"        : [],
00291     u"uz"        : [],
00292     u"va"        : [u"it"],
00293     u"vc"        : [],
00294     u"ve"        : [],
00295     u"vg"        : [],
00296     u"vi"        : [u"en"],
00297     u"vn"        : [u"vi"],
00298     u"vu"        : [],
00299     u"wf"        : [],
00300     u"ws"        : [u"sm"],
00301     u"ye"        : [],
00302     u"yt"        : [],
00303     u"yu"        : [u"sh"],
00304     u"za"        : [u"af"],
00305     u"zm"        : [],
00306     u"zw"        : [],
00307 }
00308