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
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
260
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
330
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
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
120
技術的負債解消で開発者の未来を開く- AIの力でコード刷新
kmd2kmd
0
120
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
800
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
Oxlintのカスタムルールの現況
syumai
6
1.2k
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
230
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
180
AIで効率化できた業務・日常
ochtum
0
150
Vite+ Unified Toolchain for the Web
naokihaba
0
370
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
140
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
210
Featured
See All Featured
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
570
A Soul's Torment
seathinner
6
3k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
240
Test your architecture with Archunit
thirion
1
2.3k
The SEO Collaboration Effect
kristinabergwall1
1
490
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
620
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
320
4 Signs Your Business is Dying
shpigford
187
22k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
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!