# `sol.i18n` -- Internationalization utilities

`sol.i18n.``DOMAIN` = 'sol-server'

  The translation domain of the server side

`sol.i18n.``countries_names`(request=None)

  Build a list of dictionaries `(code, translated-name)` of all known countries.

`sol.i18n.``country_name`(code, request=None)

  Translate the given ISO 3166 country code name.

`sol.i18n.``gettext`(s, **kw)

  Immediately translate the given string with current request locale

  Parameters

    - s -- either a string or a TranslationString instance

    - just_subst -- by default False, True to disable the actual translation and perform only mapping substitution

`sol.i18n.``language_name`(code, request=None)

  Translate the given ISO 639-3 language code.

`sol.i18n.``languages_names`(request=None)

  Build a list of dictionaries `(code, translated-name)` of all available languages.

`sol.i18n.``locale_negotiator`(request, _available_languages=[])

  Recognize the user preferred language.

  Parameters

    - request -- the Pyramid request

    - _available_languages -- the list of available languages (this is used as a cache, computed at the first call to this function)

  Honor the user preferred language, stored in the `ui_language` slot of the request's `session` at login time by `sol.views.auth.auth_user()`, falling back to the language accepted by the user's browser.

`sol.i18n.``ngettext`(s, p, n, **kw)

  Immediately translate the singular or plural form with current request locale

  Parameters

    - s -- either a string or a TranslationString instance with the singular form

    - p -- either a string or a TranslationString instance with the plural form

    - n -- an integer

`sol.i18n.``translatable_string`(msgid, mapping=None, default=None, context=None)

  A function to make a translatable string.

`sol.i18n.``translator`(request)

  Return a function that translates a given string in the specified request

  Parameters

    request -- either None or a Pyramid request instance

  This is an helper function that handle the case when the request does not exist, for example while testing:

      >>> t = translator(None)
      >>> t('$first $last', mapping=dict(first='Foo', last='Bar'))
      'Foo Bar'