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
[Kaohsiung Rails meetup] 國際化影片分享網站
Search
HeChien Hsu
March 29, 2014
Programming
0
160
[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
43
[Wheel Lab #2] Apple Service with Rails.
hechien
0
74
[Sokoos][教育訓練] Git - 1
hechien
0
150
[數位教學] 用Bootstrap製作網頁
hechien
0
1.3k
DesignYou - 專題報告投影片
hechien
0
110
[作業] 創意美學
hechien
0
52
[教育訓練] Rails Form Basic
hechien
1
68
[教育訓練] Rails Validation Basic
hechien
1
78
Rails Layout Basic
hechien
2
120
Other Decks in Programming
See All in Programming
Boast Code Party / RubyKaigi 2025 After Event
lemonade_37
0
120
Storybookの情報をMCPサーバー化する
shota_tech
3
1.3k
Road to Ruby for A Linguistics Nerd
hayat01sh1da
PRO
0
360
ビカム・ア・コパイロット
ymd65536
1
160
Rubyの!メソッドをちゃんと理解する
alstrocrack
2
370
今話題のMCPサーバーをFastAPIでサッと作ってみた
yuukis
0
140
エンジニア向けCursor勉強会 @ SmartHR
yukisnow1823
3
13k
20250426 GDGoC 合同新歓 - GDGoC のススメ
getty708
0
120
「MCPを使ってる人」が より詳しくなるための解説
yamaguchidesu
0
250
OpenTelemetryで始めるベンダーフリーなobservability / Vendor-free observability starting with OpenTelemetry
seike460
PRO
0
120
MySQL初心者が311個のカラムにNot NULL制約を追加していってALTER TABLEについて学んだ話
hatsu38
2
150
設計の本質:コード、システム、そして組織へ / The Essence of Design: To Code, Systems, and Organizations
nrslib
10
3.9k
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
336
57k
GraphQLとの向き合い方2022年版
quramy
46
14k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
5
580
Product Roadmaps are Hard
iamctodd
PRO
53
11k
Documentation Writing (for coders)
carmenintech
71
4.8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.7k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.2k
Docker and Python
trallard
44
3.4k
Fontdeck: Realign not Redesign
paulrobertlloyd
84
5.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
33k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
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