<s> from pyramid . config import Configurator <EOL> from pyramid . i18n import ( <EOL> get_localizer , <EOL> get_locale_name , <EOL> TranslationStringFactory <EOL> ) <EOL> _ = TranslationStringFactory ( '<STR_LIT>' ) <EOL> def root_view ( request ) : <EOL> request . locale_name = '<STR_LIT>' <EOL> localizer = get_localizer ( request ) <EOL> return { <EOL> '<STR_LIT>' : localizer . translate ( _ ( '<STR_LIT>' ) ) , <EOL> '<STR_LIT>' : get_locale_name ( request ) <EOL> } <EOL> def app ( global_settings , ** settings ) : <EOL> config = Configurator ( settings = settings ) <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_route ( name = '<STR_LIT:root>' , pattern = '<STR_LIT:/>' ) <EOL> config . add_view ( root_view , <EOL> renderer = '<STR_LIT>' ) <EOL> config . add_translation_dirs ( '<STR_LIT>' ) <EOL> return config . make_wsgi_app ( ) <EOL> class Mainer ( object ) : <EOL> import wsgiref . simple_server <EOL> make_server = wsgiref . simple_server . make_server <EOL> def main ( self ) : <EOL> port = <NUM_LIT> <EOL> httpd = self . make_server ( '<STR_LIT>' , port , app ( { } , ** { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> } ) ) <EOL> httpd . serve_forever ( ) <EOL> main = Mainer ( ) . main <EOL> if __name__ == '<STR_LIT:__main__>' : main ( ) </s>
