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
78
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
CSC509 Lecture 12
javiergs
PRO
0
160
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
Amazon Qを使ってIaCを触ろう!
maruto
0
410
CSC509 Lecture 11
javiergs
PRO
0
180
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
920
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
RubyLSPのマルチバイト文字対応
notfounds
0
120
Ethereum_.pdf
nekomatu
0
460
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Featured
See All Featured
Bash Introduction
62gerente
608
210k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Embracing the Ebb and Flow
colly
84
4.5k
How STYLIGHT went responsive
nonsquared
95
5.2k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
KATA
mclloyd
29
14k
GitHub's CSS Performance
jonrohan
1030
460k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Raft: Consensus for Rubyists
vanstee
136
6.6k
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