Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
I18n Alchemy
Search
Plataformatec
August 30, 2012
Programming
25k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
270
Elixir @ iMasters Intercon 2016
plataformatec
1
290
GenStage and Flow by @josevalim at ElixirConf
plataformatec
17
2.9k
Elixir: Programação Funcional e Pragmática @ 2º Tech Day Curitiba
plataformatec
2
350
Elixir: Programação Funcional e Pragmática @ Encontro Locaweb 2016
plataformatec
4
330
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.6k
Other Decks in Programming
See All in Programming
SONY CISC-NEWS NWS-1750 + NWB-225 フレームバッファの NetBSD/news68k ドライバ実装 / OSC2026Hiroshima
tsutsui
0
110
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
260
FreeBSDでZabbixを動かす.pdf
kenkino
0
280
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
250
How I Stole PSI from Android Studio - DroidKaigi2026
worker8
0
130
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
120
What We Talk About When We Talk About XP
m_seki
2
630
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.7k
Family mrubyの進捗
kishima
1
120
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
320
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
0
180
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
230
Featured
See All Featured
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
230
4 Signs Your Business is Dying
shpigford
187
23k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
300
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
510
How to Talk to Developers About Accessibility
jct
2
550
Speed Design
sergeychernyshev
33
2.1k
The untapped power of vector embeddings
frankvandijk
2
1.9k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
HDC tutorial
michielstock
2
870
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
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!