Back to index

plone3  3.1.7
Functions
plone.i18n.locales.tests.test_languages Namespace Reference

Functions

def configurationSetUp
def testContentLanguageAvailability
def testMetadataLanguageAvailability
def test_suite

Function Documentation

Definition at line 20 of file test_languages.py.

00020 
00021 def configurationSetUp(self):
00022     setUp()
00023     XMLConfig('meta.zcml', zope.component)()
00024     XMLConfig('meta.zcml', zope.app.publisher.browser)()
00025     XMLConfig('configure.zcml', plone.i18n.locales)()

Here is the call graph for this function:

Definition at line 141 of file test_languages.py.

00141 
00142 def test_suite():
00143     return unittest.TestSuite((
00144         DocTestSuite('plone.i18n.locales.languages'),
00145         DocTestSuite(setUp=configurationSetUp,
00146                      tearDown=tearDown,
00147                      optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE),
00148         ))

  >>> util = queryUtility(IContentLanguageAvailability)
  >>> util
  <plone.i18n.locales.languages.ContentLanguageAvailability object at ...>

  >>> languagecodes = util.getAvailableLanguages()
  >>> len(languagecodes)
  148

  >>> u'de' in languagecodes
  True

  >>> languagecodes = util.getAvailableLanguages(combined=True)
  >>> len(languagecodes)
  373

  >>> u'pt-br' in languagecodes
  True

  >>> languages = util.getLanguages()
  >>> len(languages)
  148

  >>> de = languages[u'de']
  >>> de[u'name']
  u'German'

  >>> de[u'native']
  u'Deutsch'

  >>> de[u'flag']
  u'/++resource++country-flags/de.gif'

  >>> languages = util.getLanguageListing()
  >>> len(languages)
  148

  >>> (u'de', u'German') in languages
  True

  >>> languages = util.getLanguages(combined=True)
  >>> len(languages)
  373

  >>> pt_BR = languages[u'pt-br']
  >>> pt_BR[u'name']
  u'Portuguese (Brazil)'

Definition at line 26 of file test_languages.py.

00026 
00027 def testContentLanguageAvailability():
00028     """
00029       >>> util = queryUtility(IContentLanguageAvailability)
00030       >>> util
00031       <plone.i18n.locales.languages.ContentLanguageAvailability object at ...>
00032 
00033       >>> languagecodes = util.getAvailableLanguages()
00034       >>> len(languagecodes)
00035       148
00036 
00037       >>> u'de' in languagecodes
00038       True
00039 
00040       >>> languagecodes = util.getAvailableLanguages(combined=True)
00041       >>> len(languagecodes)
00042       373
00043 
00044       >>> u'pt-br' in languagecodes
00045       True
00046 
00047       >>> languages = util.getLanguages()
00048       >>> len(languages)
00049       148
00050 
00051       >>> de = languages[u'de']
00052       >>> de[u'name']
00053       u'German'
00054 
00055       >>> de[u'native']
00056       u'Deutsch'
00057 
00058       >>> de[u'flag']
00059       u'/++resource++country-flags/de.gif'
00060 
00061       >>> languages = util.getLanguageListing()
00062       >>> len(languages)
00063       148
00064 
00065       >>> (u'de', u'German') in languages
00066       True
00067 
00068       >>> languages = util.getLanguages(combined=True)
00069       >>> len(languages)
00070       373
00071 
00072       >>> pt_BR = languages[u'pt-br']
00073       >>> pt_BR[u'name']
00074       u'Portuguese (Brazil)'
00075     """

  >>> util = queryUtility(IMetadataLanguageAvailability)
  >>> util
  <plone.i18n.locales.languages.MetadataLanguageAvailability object at ...>

  >>> languagecodes = util.getAvailableLanguages()
  >>> len(languagecodes)
  148

  >>> u'de' in languagecodes
  True

  >>> languagecodes = util.getAvailableLanguages(combined=True)
  >>> len(languagecodes)
  373

  >>> u'pt-br' in languagecodes
  True

  >>> languages = util.getLanguages()
  >>> len(languages)
  148

  >>> de = languages[u'de']
  >>> de[u'name']
  u'German'

  >>> de[u'native']
  u'Deutsch'

  >>> de[u'flag']
  u'/++resource++country-flags/de.gif'

  >>> languages = util.getLanguageListing()
  >>> len(languages)
  148

  >>> (u'de', u'German') in languages
  True

  >>> languages = util.getLanguageListing(combined=True)
  >>> len(languages)
  373

  >>> (u'pt-br', u'Portuguese (Brazil)') in languages
  True

  >>> languages = util.getLanguageListing(combined=True)
  >>> len(languages)
  373

  >>> (u'pt-br', u'Portuguese (Brazil)') in languages
  True

  >>> languages = util.getLanguages(combined=True)
  >>> len(languages)
  373

  >>> pt_BR = languages[u'pt-br']
  >>> pt_BR[u'name']
  u'Portuguese (Brazil)'

Definition at line 76 of file test_languages.py.

00076 
00077 def testMetadataLanguageAvailability():
00078     """
00079       >>> util = queryUtility(IMetadataLanguageAvailability)
00080       >>> util
00081       <plone.i18n.locales.languages.MetadataLanguageAvailability object at ...>
00082 
00083       >>> languagecodes = util.getAvailableLanguages()
00084       >>> len(languagecodes)
00085       148
00086 
00087       >>> u'de' in languagecodes
00088       True
00089 
00090       >>> languagecodes = util.getAvailableLanguages(combined=True)
00091       >>> len(languagecodes)
00092       373
00093 
00094       >>> u'pt-br' in languagecodes
00095       True
00096 
00097       >>> languages = util.getLanguages()
00098       >>> len(languages)
00099       148
00100 
00101       >>> de = languages[u'de']
00102       >>> de[u'name']
00103       u'German'
00104 
00105       >>> de[u'native']
00106       u'Deutsch'
00107 
00108       >>> de[u'flag']
00109       u'/++resource++country-flags/de.gif'
00110 
00111       >>> languages = util.getLanguageListing()
00112       >>> len(languages)
00113       148
00114 
00115       >>> (u'de', u'German') in languages
00116       True
00117 
00118       >>> languages = util.getLanguageListing(combined=True)
00119       >>> len(languages)
00120       373
00121 
00122       >>> (u'pt-br', u'Portuguese (Brazil)') in languages
00123       True
00124 
00125       >>> languages = util.getLanguageListing(combined=True)
00126       >>> len(languages)
00127       373
00128 
00129       >>> (u'pt-br', u'Portuguese (Brazil)') in languages
00130       True
00131 
00132       >>> languages = util.getLanguages(combined=True)
00133       >>> len(languages)
00134       373
00135 
00136       >>> pt_BR = languages[u'pt-br']
00137       >>> pt_BR[u'name']
00138       u'Portuguese (Brazil)'
00139     """
00140