Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
i18n for Haskell Web Applications
Search
Philip Cunningham
October 07, 2016
Programming
0
77
i18n for Haskell Web Applications
https://skillsmatter.com/skillscasts/8770-i18n-for-haskell-web-applications
Philip Cunningham
October 07, 2016
Tweet
Share
Other Decks in Programming
See All in Programming
Micro Frontends for Java Microservices - Utah JUG 2024
mraible
PRO
1
110
PostmanでAPIの動作確認が楽になった話
h455h1
0
180
Domain-Driven Transformation
hschwentner
2
1.5k
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
1.1k
2 週間で Twitter Bot を作ってみた
contour_gara
0
790
Going beyond Apache Parquet's default settings
xhochy
0
140
Goのmultiple errorsについて (2024年4月版)
syumai
4
1.2k
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
2
210
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
200
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
130
新宿ダンジョンを可視化してみた
satoshi7190
3
400
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
280
Featured
See All Featured
Designing for Performance
lara
601
67k
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
It's Worth the Effort
3n
180
27k
A Tale of Four Properties
chriscoyier
153
22k
Robots, Beer and Maslow
schacon
PRO
155
7.9k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.9k
Testing 201, or: Great Expectations
jmmastey
30
6.4k
A Philosophy of Restraint
colly
197
16k
Documentation Writing (for coders)
carmenintech
60
4k
The Illustrated Children's Guide to Kubernetes
chrisshort
32
46k
Building Adaptive Systems
keathley
32
1.9k
Transcript
Philip Cunningham i18n for Haskell Web Applications @unsymbol
None
None
None
None
None
Annotate Locate Extract Translate
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
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
What now?
Don’t panic.
None
Locale
en-GB ISO639 ISO3166
pt-BR ISO639 ISO3166
i18n
l10n
Annotate Locate Extract Translate
<#welcome-message> #{ __("Hello there.") }
<#welcome-message> #{ __("Hello there.") }
Tip 1
<#welcome-message> #{ __("Hello there, ") <> userName <> "." }
<#welcome-message> #{ format $ __("Hello there, {}.") $ Only userName
}
Annotate Locate Extract Translate
welcomePage = do l10n <- lift getL10n locale <- param
"locale" let __ = localize l10n (Locale locale) . gettext html . toStrict $ renderHtml (applicationLayout __)
welcomePage = do l10n <- lift getL10n locale <- param
"locale" let __ = localize l10n (Locale locale) . gettext html . toStrict $ renderHtml (applicationLayout __)
welcomePage = do l10n <- lift getL10n locale <- param
"locale" let __ = localize l10n (Locale locale) . gettext html . toStrict $ renderHtml (applicationLayout __)
welcomePage = do l10n <- lift getL10n locale <- param
"locale" let __ = localize l10n (Locale locale) . gettext html . toStrict $ renderHtml (applicationLayout __)
Tip 2
• Use geolocation. • Use the HTTP Accept-Language header. •
Use a locale param in the URL. • Let the user set their own preferences.
• Use geolocation. • Use the HTTP Accept-Language header. •
Use a locale param in the URL. • Let the user set their own preferences.
Annotate Locate Extract Translate
i18n find \ —keyword _ \ —output app.pot \ template.hamlet
pt-BR.po en-GB.po app.pot
Tip 3
Annotate Locate Extract Translate
• Poedit - GUI desktop application. • Transiflex - SAAS
web application. • Weblate - self-hosted open source Django application.
Tip 4
Annotate Locate Extract Translate
Thanks for listening https://github.com/filib/i18n @unsymbol
Photos Credits https://is.gd/kUEKCg https://is.gd/00ds0q https://is.gd/OJ7Cd1