Skip to content

Instantly share code, notes, and snippets.

View bater's full-sized avatar

Bater bater

View GitHub Profile
@bater
bater / i18n-with-model-and-simple_form.md
Last active September 23, 2016 06:06
i18n 搭配model與form的做法

i18n 搭配model與form的做法

在使用simple_form時,很多人會使用label來命名model的中文,其實可以透過設定model的多語系yml來實作解決這樣的需求。同時,model name本身也可以透過activerecord來設定語系。

一般的做法如下: <p><%= t(:website) %></p> 搭配語系檔的寫法:

'zh-TW':
 website: "網站"