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
81
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
Cursorハンズオン実践!
eltociear
2
1.2k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
660
Webサーバーサイド言語としてのRustについて
kouyuume
1
4.9k
When Dependencies Fail: Building Antifragile Applications in a Fragile World
selcukusta
0
110
Pythonに漸進的に型をつける
nealle
1
130
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
3
980
Six and a half ridiculous things to do with Quarkus
hollycummins
0
220
pnpm に provenance のダウングレード を検出する PR を出してみた
ryo_manba
1
160
CSC509 Lecture 07
javiergs
PRO
0
250
CSC305 Lecture 10
javiergs
PRO
0
270
あなたとKaigi on Rails / Kaigi on Rails + You
shimoju
0
190
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.7k
Automating Front-end Workflow
addyosmani
1371
200k
Into the Great Unknown - MozCon
thekraken
40
2.1k
Music & Morning Musume
bryan
46
6.9k
For a Future-Friendly Web
brad_frost
180
10k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
640
How to Ace a Technical Interview
jacobian
280
24k
A Modern Web Designer's Workflow
chriscoyier
697
190k
GraphQLとの向き合い方2022年版
quramy
49
14k
Being A Developer After 40
akosma
91
590k
Building an army of robots
kneath
305
46k
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