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 Alchemy
Search
Plataformatec
August 30, 2012
Programming
25k
1
Share
I18n Alchemy
Lightning Talk por Lucas Mazza, na RubyConf Brasil 2012.
Plataformatec
August 30, 2012
More Decks by Plataformatec
See All by Plataformatec
O case da Plataformatec com o Elixir - Como uma empresa brasileira criou uma linguagem que é usada no mundo inteiro @ Elixir Brasil 2019
plataformatec
5
1.2k
O case da Plataformatec com o Elixir - Como uma empresa brasileira criou uma linguagem que é usada no mundo inteiro @ QCon SP 2018
plataformatec
1
250
Elixir @ iMasters Intercon 2016
plataformatec
1
280
GenStage and Flow by @josevalim at ElixirConf
plataformatec
17
2.9k
Elixir: Programação Funcional e Pragmática @ 2º Tech Day Curitiba
plataformatec
2
320
Elixir: Programação Funcional e Pragmática @ Encontro Locaweb 2016
plataformatec
4
320
What's ahead for Elixir: v1.2 and GenRouter
plataformatec
15
2.2k
Arquiteturas Comuns de Apps Rails @ RubyConf BR 2015
plataformatec
6
410
Pirâmide de testes, escrevendo testes com qualidade @ RubyConf 2015
plataformatec
10
2.5k
Other Decks in Programming
See All in Programming
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
490
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
760
AIを導入する前にやるべきこと
negima
2
340
継続的な負荷検証を目指して
pyama86
1
820
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
22
11k
Firefoxにコントリビューションして得られた学び
ken7253
2
160
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
330
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
130
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
340
t *testing.T は どこからやってくるの?
otakakot
1
910
Back to the roots of date
jinroq
0
740
AIと共に生きる技術選定 2026
sgash708
0
130
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
9
820
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
160
The SEO identity crisis: Don't let AI make you average
varn
0
460
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
350
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
530
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
210
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
170
Mobile First: as difficult as doing things right
swwweet
225
10k
Optimizing for Happiness
mojombo
378
71k
Designing Powerful Visuals for Engaging Learning
tmiket
1
360
Transcript
I18nAlchemy
@lucasmazza
None
datas, números e valores • DD/MM/YYYY ➜ MM/DD/YYYY • 1.5
➜ 1.50 • 1,000.00 ➜ 1000.00
Rails + i18n l(@event.starts_at, :format => :short) # '30 de
Agosto' number_with_precision(1200.3) # '1,200.30'
@event.starts_at = '30/08/2012' @event.starts_at # nil
lol no @event.starts_at = '30/08/2012' @event.starts_at # nil
gem install i18n-alchemy
@cantoniodasilva
@cantoniodasilva señor developer @ plataformatec
@cantoniodasilva señor developer @ plataformatec “ENTENDENDO E TIRANDO O MELHOR
DO RAILS ACTIVE MODEL” 11h @ Sala 2
class Event < ActiveRecord::Base include I18n::Alchemy localize :starts_at, :ends_at, :price
end I18nAlchemy
class Event < ActiveRecord::Base include I18n::Alchemy localize :starts_at, :ends_at, :price
end I18nAlchemy
I18n.with_locale :pt do @event.localized.starts_at = '30/08/2012' @event.starts_at # => Date.new(2012,
08, 30) @event.localized.starts_at # => '30/08/2012' @event.localized.price = '150,00' @event.localized.starts_at = 3.days.ago @event.save! end I18nAlchemy
.localized?
.localized? • I18n::Alchemy::Proxy
.localized? • I18n::Alchemy::Proxy • Nada de sobreescrever acessores
.localized? • I18n::Alchemy::Proxy • Nada de sobreescrever acessores • Manipula
apenas os atributos configurados
I18nAlchemy class Product < ActiveRecord::Base include I18n::Alchemy localize :total, :using
=> :number def total quantity * price end end
I18nAlchemy • Configurações através do i18n • Não é dependente
do ActiveRecord • Escreva os seus próprios parsers!
module MyParser def self.parse(value) # ... end def self.localize(value) #
... end end class Product < ActiveRecord::Base include I18n::Alchemy localize :total, :using => MyParser end
Para pull requests, issues, declarações de amor e afins: https://github.com/carlosantoniodasilva/i18n_alchemy
Obrigado!