Upgrade to Pro — share decks privately, control downloads, hide ads and more …

i18n for Haskell Web Applications

i18n for Haskell Web Applications

Philip Cunningham

October 07, 2016
Tweet

Other Decks in Programming

Transcript

  1. main = do setLocale LC_ALL (Just "") bindTextDomain "hello" (Just

    ".") textDomain (Just "hello") putStrLn (__ "Please enter your name:") name <- getLine printf (__ "Hello, %s, how are you?") name
  2. main = do setLocale LC_ALL (Just "") bindTextDomain "hello" (Just

    ".") textDomain (Just "hello") putStrLn (__ "Please enter your name:") name <- getLine printf (__ "Hello, %s, how are you?") name
  3. welcomePage = do l10n <- lift getL10n locale <- param

    "locale" let __ = localize l10n (Locale locale) . gettext html . toStrict $ renderHtml (applicationLayout __)
  4. welcomePage = do l10n <- lift getL10n locale <- param

    "locale" let __ = localize l10n (Locale locale) . gettext html . toStrict $ renderHtml (applicationLayout __)
  5. welcomePage = do l10n <- lift getL10n locale <- param

    "locale" let __ = localize l10n (Locale locale) . gettext html . toStrict $ renderHtml (applicationLayout __)
  6. welcomePage = do l10n <- lift getL10n locale <- param

    "locale" let __ = localize l10n (Locale locale) . gettext html . toStrict $ renderHtml (applicationLayout __)
  7. • Use geolocation. • Use the HTTP Accept-Language header. •

    Use a locale param in the URL. • Let the user set their own preferences.
  8. • Use geolocation. • Use the HTTP Accept-Language header. •

    Use a locale param in the URL. • Let the user set their own preferences.
  9. • Poedit - GUI desktop application. • Transiflex - SAAS

    web application. • Weblate - self-hosted open source Django application.