Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[Kaohsiung Rails meetup] 國際化影片分享網站
Search
HeChien Hsu
March 29, 2014
Programming
0
170
[Kaohsiung Rails meetup] 國際化影片分享網站
2014-03-29 分享於高雄 Rails meetup
HeChien Hsu
March 29, 2014
Tweet
Share
More Decks by HeChien Hsu
See All by HeChien Hsu
Using Git hosting
hechien
0
45
[Wheel Lab #2] Apple Service with Rails.
hechien
0
80
[Sokoos][教育訓練] Git - 1
hechien
0
150
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
110
[作業] 創意美學
hechien
0
59
[教育訓練] Rails Form Basic
hechien
1
74
[教育訓練] Rails Validation Basic
hechien
1
81
Rails Layout Basic
hechien
2
120
Other Decks in Programming
See All in Programming
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
600
JETLS.jl ─ A New Language Server for Julia
abap34
1
320
AIコーディングエージェント(Manus)
kondai24
0
160
dotfiles 式年遷宮 令和最新版
masawada
1
740
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
200
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
120
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
430
Developing static sites with Ruby
okuramasafumi
0
260
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
38
25k
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
310
FluorTracer / RayTracingCamp11
kugimasa
0
220
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
11
11k
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Making Projects Easy
brettharned
120
6.5k
Side Projects
sachag
455
43k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Code Review Best Practice
trishagee
74
19k
Building an army of robots
kneath
306
46k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
How to Ace a Technical Interview
jacobian
280
24k
Transcript
國際化影⽚片分享網站 徐赫謙
About me • 徐赫謙 - HeChien Hsu •
[email protected]
•
http://fb.com/hechien • http://hechien.logdown.com
國際化?
I18n Internationalization
影⽚片分享?
不是真的上傳影⽚片
Share the video links
請你跟我這樣做
rails new my_videos
rails g scaffold video title link
rake db:migrate
我們需要這些 Gem
我們需要這些 Gem • rails • embedly # 抓 video link
⽤用 • faraday # embedly 說它要存在才讓我⽤用 T_T • settingslogic # 為了儲存⼀一些設定
關於「分享影⽚片」 • 其實就是透過 embedly 去抓取影⽚片資料
ShareLinkService • https://gist.github.com/hechien/ f317ebf120e573c96daf#file-share_link_service- rb • 把它放在你的 app/services 底下,命名為 share_link_service.rb
關於「國際化」 • 國際化分為兩件事 • i18n • Timezone
Internationalization • 簡稱:i18n (不然真的太⻑⾧長) • 在 /config/application.rb • config.i18n.default_locale =
:zh-TW • 語系檔放在 /config/locales ⽤用 YAML 撰寫
Internationalization (cont.) • I18n.t(key) # 任何地⽅方皆可使⽤用 • I18n.t(key, scope: scope)
# 任何地⽅方皆可使⽤用, 並指定 scope • t(key) # View Helper • t(key, scope: scope) # View Helper with scope
Timezone • rake time:zones:all # 得到所有時區清單 • rake time:zones:us #
美國地區的時區清單 • rake time:zones:local # 當前地區的時區清單 • rake time:zones:all OFFSET=8 # +08:00 的地區
Timezone (cont.) • time_zone_select # FormHelper
Timezone (cont.) • Time.current • Date.current • 10.days.ago • 1.days.from_now
• … • 以上都會吃到 Timezone 設定
Timezone (cont.) • Time.now / Date.today => 沒有吃到 Timezone 設
定
DEMO
懶得寫⼀一堆 i18n 怎辦
懶得寫⼀一堆 i18n 怎辦 • rails-i18n • http://github.com/svenfuchs/rails-i18n
為薄滴賽 • ⼀一個討論 Web Design / Development 的 Facebook Group
Q & A
Thank you