Last active
December 22, 2015 19:29
-
-
Save tomotaka/6519987 to your computer and use it in GitHub Desktop.
use pyramid i18n(localizer) out side of web framework(in my case, it's test)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyramid.i18n import make_localizer, TranslationString | |
dir = '/your/locale/dir' | |
directories = (dir,) | |
txt_want_to_translate = TranslationString('hoge_moge') | |
# txt_want_to_translate = TranslationString('hoge_moge', domain='some_domain') | |
locale = 'ja' | |
localizer = make_localizer(locale, directories) | |
transltaed_str = localizer.translate(txt_want_to_translate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment