Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 635283 Details for
Bug 866730
invalid locales configured for some languages
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
localization-test-3.py locale validation test for pyanaconda/localization.py
localization-test-3.py (text/plain), 3.06 KB, created by
Steve Tyler
on 2012-10-30 02:37:09 UTC
(
hide
)
Description:
localization-test-3.py locale validation test for pyanaconda/localization.py
Filename:
MIME Type:
Creator:
Steve Tyler
Created:
2012-10-30 02:37:09 UTC
Size:
3.06 KB
patch
obsolete
>#!/usr/bin/python > ># ># localization-test-3.py ># Validate locales from pyanaconda/localization.py. ># ># Usage: ./localization-test-3.py [localization_module[.py]] ># ># A copy of pyanaconda/localization.py ># is assumed to be in the local directory. ># Several copies can coexist, if they are renamed: ># localization_XX_YY_Z.py. ># The default module name is 'localization'. ># Any '.py' extension is removed. ># ># Records are tagged for machine-processing: ># D: Documentation ># L: Locale ># S: Summary ># E: Error ># > >import os >import sys >from importlib import import_module >from datetime import datetime >import locale >import babel > >localization_module = "localization" # default >if len(sys.argv) > 1: > a = sys.argv[1] > (root, ext) = os.path.splitext(a) > if ext == '.py': # remove any '.py' extension > localization_module = root > else: > localization_module = a > ># import localization module under test >ll = import_module(localization_module) > >timestamp = datetime.utcnow().strftime('%F %T UTC') > >print "D: summary: pyanaconda/localization.py locale validation test" >print >print "D: module: %s" % ll.__dict__['__name__'] >print "D: timestamp: %s" % timestamp >print >print "D: n: count" >print "D: short_name: from LocaleInfo object" >print "D: locale.normalize(): value of normalize(short_name) from locale module" >print "D: v1: short_name is valid if 1, invalid if 0" >print "D: v2: normalize(short_name) is valid if 1, invalid if 0" >print "D: english_name: from LocaleInfo object" >print >print "D: note: A valid locale is defined as having a language and a territory." >print >print "L: %3s: %-20s %-20s %3s %3s %-30s" % ('n', 'short_name', 'locale.normalize()', 'v1', 'v2', 'english_name') > >isvalid_count_1 = 0 >isvalid_count_2 = 0 > >recd_list = [] >err_list = [] >for loc_1 in ll.get_available_translations(domain='anaconda', localedir='/usr/share/locale'): > > isvalid_1 = loc_1.language != None and loc_1.territory != None > > try: > l_norm = locale.normalize(loc_1.short_name) > localedata = babel.Locale.parse(l_norm) > loc_2 = ll.LocaleInfo(localedata) > isvalid_2 = loc_2.language != None and loc_2.territory != None > except babel.core.UnknownLocaleError as e: > err_msg = "babel: %s" % e > err_list.append(err_msg) > isvalid_2 = 0 > except: > raise > > isvalid_count_1 += isvalid_1 > isvalid_count_2 += isvalid_2 > > recd = "%-20s %-20s %3d %3d %-30s" % \ > (loc_1.short_name, l_norm, isvalid_1, isvalid_2, "'" + loc_1.english_name + "'") > recd_list.append(recd) > >record_count = 0 >for recd in sorted(recd_list): # get_available_translations() doesn't return a sorted list > record_count += 1 > print "L: %3d: %s" % (record_count, recd.encode("utf-8")) > >print >print "S: isvalid_count_1: %3d" % isvalid_count_1 >print "S: isvalid_count_2: %3d" % isvalid_count_2 >print "S: record_count: %3d" % record_count > >print >print "E: %3s: %s" % ('n', 'err_msg') > >err_count = 0 >for err in err_list: > err_count += 1 > print "E: %3d: %s" % (err_count, err) > >exit(0) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 866730
:
629895
|
630267
|
630273
|
632405
|
632419
| 635283 |
635315
|
635331
|
636385
|
637082
|
637222
|
637237
|
637385