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
80
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
CI改善もDatadogとともに
taumu
0
110
Grafana Cloudとソラカメ
devoc
0
140
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
360
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
870
Multi Step Form, Decentralized Autonomous Organization
pumpkiinbell
1
720
負債になりにくいCSSをデザイナとつくるには?
fsubal
9
2.4k
GoとPHPのインターフェイスの違い
shimabox
2
170
Honoとフロントエンドの 型安全性について
yodaka
5
330
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
220
自分ひとりから始められる生産性向上の取り組み #でぃーぷらすオオサカ
irof
8
2.7k
AWS Organizations で実現する、 マルチ AWS アカウントのルートユーザー管理からの脱却
atpons
0
130
Grafana Loki によるサーバログのコスト削減
mot_techtalk
1
120
Featured
See All Featured
Faster Mobile Websites
deanohume
306
31k
A Tale of Four Properties
chriscoyier
158
23k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
31
2.1k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
29
2.2k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
240
Product Roadmaps are Hard
iamctodd
PRO
50
11k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
What's in a price? How to price your products and services
michaelherold
244
12k
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