Example #1
0
def getFlagBitmapForLocale(locale):
    u"""getFlagBitmapForLocale(string|ZLocale) -> wx.Bitmap
    Gets the flag bitmap for the given ZLocale or locale string.""" #$NON-NLS-1$

    if not isinstance(locale, ZLocale):
        locale = ZLocale(locale)
    bitmap = None
    if locale.hasCountryCode():
        bitmap = getResourceRegistry().getBitmap(u"images/common/flags/%s.png" % string.lower(locale.getCountryCode())) #$NON-NLS-1$
    if bitmap is None:
        bitmap = getResourceRegistry().getBitmap(u"images/common/flags/%s.png" % locale.getLanguageCode()) #$NON-NLS-1$
    return bitmap
Example #2
0
def getFlagPathForLocale(localeStr):
    u"""getFlagPathForLocale(string) -> string
    Gets the flag bitmap path for the given locale.""" #$NON-NLS-1$

    locale = ZLocale(localeStr)
    bitmapPath = None
    if locale.hasCountryCode():
        bitmapPath = getResourceRegistry().getImagePath(u"images/common/flags/%s.png" % string.lower(locale.getCountryCode())) #$NON-NLS-1$
    if bitmapPath is None or not os.path.isfile(bitmapPath):
        bitmapPath = getResourceRegistry().getImagePath(u"images/common/flags/%s.png" % locale.getLanguageCode()) #$NON-NLS-1$
    if bitmapPath is None or not os.path.isfile(bitmapPath):
        bitmapPath = None
    return bitmapPath