def GetSelectionPosition(self):
        localeSet = getLocaleSet()

        for loc in localeSet:
            try:
                #raises a ValueError if the string does not contain a '_'
                loc.index("_")
                #Strip the country code from the locale string
                loc = loc.split("_")[1]
            except ValueError:
                pass

            for i in xrange(len(_SITE_CODES)):
                if _SITE_CODES[i] == loc.lower():
                    return i
        return 0
예제 #2
0
    def GetSelectionPosition(self):
        localeSet = getLocaleSet()

        for loc in localeSet:
            try:
                #raises a ValueError if the string does not contain a '_'
                loc.index("_")
                #Strip the country code from the locale string
                loc = loc.split("_")[1]
            except ValueError:
                pass

            for i in xrange(len(_SITE_CODES)):
                if _SITE_CODES[i] == loc.lower():
                    return i
        return 0
예제 #3
0
import random

from datetime import datetime, timedelta
from osaf import pim
import osaf.pim.calendar.Calendar as Calendar
from osaf.pim import Modification
import osaf.pim.mail as Mail
import i18n
try:
    from i18n.tests import uw
except ImportError:
    uw = lambda _: _  # make uw a no-op
from application import schema

TEST_I18N = i18n.getLocaleSet() and 'test' in i18n.getLocaleSet()

HEADLINES = ["Dinner", "Lunch", "Meeting", "Movie", "Games"]

DURATIONS = [60, 90, 120, 150, 180]

REMINDERS = [
    None, None, None, None, 1, 10
]  # The "None"s make only a 30% chance an event will have a reminder...


def GenerateCalendarParticipant(view):
    domainName = random.choice(DOMAIN_LIST)
    handle = random.choice(LASTNAMES).lower()
    email = Mail.EmailAddress.getEmailAddress(view,
                                              "%s@%s" % (handle, domainName))
예제 #4
0
import sys, os
from i18n import wxMessageFactory as w

"""
Command line utility to confirm that wx localization files are loaded
   And options locale can be specified on the command line: If no locale is
   passed the System default locale is used:

   Load the French wx translations:
   ===================================
   ./release/RunPython i18n/tests/wxLocalizationTest.py fr


   Load the System default  wx translations:
   ===================================
   ./release/RunPython i18n/tests/wxLocalizationTest.py
"""
i18nMan = i18n._I18nManager

if len(sys.argv) > 1:
    i18nMan.initialize(sys.argv[1])
else:
    i18nMan.initialize(None)

print "Using Locale: ", i18n.getLocaleSet()[0]

print "Cancel: ", w("Cancel").encode("utf8")
print "Quit: ", w("&Quit").encode("utf8")


예제 #5
0
import random

from datetime import datetime, timedelta
from osaf import pim
import osaf.pim.calendar.Calendar as Calendar
from osaf.pim import Modification
import osaf.pim.mail as Mail
import i18n
try:
    from i18n.tests import uw
except ImportError:
    uw = lambda _:_ # make uw a no-op
from application import schema

TEST_I18N = i18n.getLocaleSet() and 'test' in i18n.getLocaleSet()

HEADLINES = ["Dinner", "Lunch", "Meeting", "Movie", "Games"]

DURATIONS = [60, 90, 120, 150, 180]

REMINDERS = [None, None, None, None, 1, 10] # The "None"s make only a 30% chance an event will have a reminder...

def GenerateCalendarParticipant(view):
    domainName = random.choice(DOMAIN_LIST)
    handle = random.choice(LASTNAMES).lower()
    email = Mail.EmailAddress.getEmailAddress(view, 
                                              "%s@%s" % (handle, domainName))
    return email

LOCATIONS  = [u"Home", u"Office", u"School"]
def translate():
    print "Using Locale: ", i18n.getLocaleSet()[0]
    print "Cancel: ", w("Cancel").encode("utf8")
    print "Quit: ", w("&Quit").encode("utf8")
from application import Utility
import i18n
import sys, os
from i18n import wxMessageFactory as w
"""
Command line utility to confirm that wx localization files are loaded
   And options locale can be specified on the command line: If no locale is
   passed the System default locale is used:

   Load the French wx translations:
   ===================================
   ./release/RunPython i18n/tests/wxLocalizationTest.py fr


   Load the System default  wx translations:
   ===================================
   ./release/RunPython i18n/tests/wxLocalizationTest.py
"""
i18nMan = i18n._I18nManager

if len(sys.argv) > 1:
    i18nMan.initialize(sys.argv[1])
else:
    i18nMan.initialize(None)

print "Using Locale: ", i18n.getLocaleSet()[0]

print "Cancel: ", w("Cancel").encode("utf8")
print "Quit: ", w("&Quit").encode("utf8")