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
[BalkanRuby 2019] Getting ready for I18n, Shopi...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Edouard Chin
May 17, 2019
Programming
280
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[BalkanRuby 2019] Getting ready for I18n, Shopify case study
Edouard Chin
May 17, 2019
More Decks by Edouard Chin
See All by Edouard Chin
[Ruby Kaigi 2026] Faster Bundler, Happier Developers
edouardchin
0
13
Journey of a complex gem upgrade
edouardchin
0
470
Upgrading Rails at scale. RailsConf 2018
edouardchin
4
1.1k
Other Decks in Programming
See All in Programming
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.6k
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
120
JavaDoc 再入門
nagise
0
320
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
110
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
390
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
330
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
4.9k
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
750
Lessons from Spec-Driven Development
simas
PRO
0
170
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
1.2k
Webフレームワークの ベンチマークについて
yusukebe
0
160
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
530
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
150
The Art of Programming - Codeland 2020
erikaheidi
57
14k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
730
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
BBQ
matthewcrist
89
10k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
360
The untapped power of vector embeddings
frankvandijk
2
1.8k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
380
Become a Pro
speakerdeck
PRO
31
6k
Transcript
Hello! Здравейте! Bonjour! ¡hola! Balkan Ruby 2019-05-17
Edouard Chin https://github.com/Edouard-chin @DaroudeDudek
None
None
2,000,000+ LOC 120,000+ Tests Some Ruby Stats Lot of hardcoded
strings
Main location of hard-coded strings • HTML / ERB (Views)
• Ruby (Helpers, Controllers) • Javascript
ui-journey-bar::before { content: 'Next: '; }
Getting ready for internationalization, Shopify's case study Balkan Ruby 2019-05-17
1) Translate your product !"#$%
/“(.*)”/
Detect hard-coded strings visible by the user def my_endpoint if
params['something'] render(plain: 'Hello World!') end end
Stop the bleeding
None
Static code analysis
<html> <body> <%= link_to('Click here', 'https://example.com') %> Hello World! </body>
</html>
ui_flag ui_title ui_content_list ui_banner … …
link_to('Click here', 'https://example.com') content_tag(‘div’, ‘Ask me!’)
None
# @example # # bad # {a:3} # # #
good # {a: 3} class SpaceAfterColon < Cop MSG = 'Space missing after colon.' def on_pair(node) return unless node.colon? colon = node.loc.operator add_offense(…) end # ... end
link_to -> LinkToCop Button -> ButtonCop … …
link_to('My link', 'https://example.com') content_tag('div', 'Hello') Positional arguments
ui_flag(country: 'US', label: 'Make it great again') Keyword arguments
submit(_, data: { confirm: ‘Send!' }, confirm: ‘data’) Options Hash
form_for @book do |f| f.check_box(:paid, {}, 'Yes', 'No') a.check_box('data') end
Blocks
ui_layout do |row| ui_data_table do |table| table.header do |section| section.row
do |row| row.header('Hello') end row.header('data') end end end Nested blocks
class UIRadioButtonHelper < Cop include BlockOutputHelperBehavior UI_HELPER_NAMES = { form_for:
:ui_radio_button } def forbidden_kwarg?(kwarg) %w(label help_text).include?(kwarg) end def argument_check_required?(index) index > 0 end end
form_for :book do |form| form.ui_radio_button( :genre, label: ‘horror', help_text: 'Scary
books’ ) end
def_node_matcher :ui_block_helper, <<-PATTERN (block { (send nil? #ui_helper_method_names ...) (send
(lvar _) #ui_helper_method_names) } (args (arg $_)) $(...)) PATTERN RuboCop NodePattern https://rubocop.readthedocs.io/en/latest/node_pattern/
<html> <body> Hello World! </body> </html>
<html> <style> p { background: white; } </style> </html>
ERB-Lint https://github.com/Shopify/erb-lint
<%= link_to('MyLink', _) %> ERB-Lint link_to('MyLink', _)
ERB-Lint https://github.com/Shopify/erb-lint
None
RuboCop autocorrection
link_to(‘My Link', _) link_to(I18n.t('path.to.file.my_l'), _) en: path: to: file: my_l:
'My Link'
en: path: to: file: my_l: 'My Link %{here}’ link_to("My Link
#{here}", _) link_to(I18n.t('path.to.file.my_l', here: here), _)
<%= I18n.t(:translation_key_html) %> <%= t(:translation_key_html) %>
bin/rubocop -only I18n .
None
Ruby I18n or gettext ?
I18n.t('some.namespace.key') en: some: namespace: key: 'Hello!' "Hello!" Ruby-i18n
"Hello!" _("Hello!") gettext .po/.mo files to store translations
https://github.com/grosser/fast_gettext/blob/ master/Readme.md#comparison
" #
None
Pseudolocalization
Ŵḛḛḅḥṓṓṓṓḳ ṡααṽḛḛḍ ṡṵṵͼͼḛḛṡṡϝṵṵḽḽẏẏ Webhook saved successfully
egg topper Eierschalensollbruchstellenv erursacher
None
https://github.com/Shopify/ pseudolocalization
MySQL character set
“".bytesize => 4
Unicode Basic Multilingual Plane
Utf8mb4
None
Expose your app to UTF8 characters
Translation vs Localization
None
" % May 3, 2019 2019-05-03 03/05/2019 YYYY-MM-DD (ISO 8601)
DD/MM/YYYY
) 2019-03-05 2019-05-03 03-05-2019
1PM VS 13:00
" %
Edouard Chin 902-210 Gloucester Street Ottawa ON K2P 2K4
Edouard Chin Ottawa ON K2P 2K4
Edouard Chin Ottawa K2P 2K4 Canada
"Miss #{last_name} #{first_name} #{apartment} #{street} #{postal_code} #{province}"
… name: 'United States' week_start_day: 'sunday' format: edit: "{firstName}{lastName}_{company}_{address1} _{address2}_{city}_{country}{province}{zip}_{phone}"
show: "{firstName} {lastName}_{company}_{address1} _{address2}_{city} {province} {zip}_{country}_{phone}"
const address = { company: 'Shopify', firstName: '恵⼦子', lastName: '⽥田中',
address1: '⼋八重洲1-5-3', address2: '', city: '⽬目黒区', province: 'JP-13', zip: '100-8994', country: 'JP', phone: '', }; const addressFormatter = new AddressFormatter('ja'); await addressFormatter.format(address); /* => ⽇日本 〒100-8994東京都⽬目黒区⼋八重洲1-5-3 Shopify ⽥田中恵⼦子様 */
https://www.npmjs.com/package/@shopify/address
Edouard Chin https://github.com/Edouard-chin @DaroudeDudek