← スキル一覧に戻る

rails-i18n
by manuelmeurer
⭐ 0🍴 1📅 2026年1月23日
SKILL.md
name: rails-i18n description: Rails I18n conventions. Use when creating or editing I18n strings in Rails.
Rails I18n
Guidelines
- Don't use relative lookups with leading dots (
.key) or chain keys together with dots (foo.bar.baz). Instead, always use a symbol as the key and an array of symbols as the scope parameter:t :baz, scope: %i[foo bar]. Only deviate from this rule if absolutely necessary. - Always try to use
action_i18n_scopeorbase_i18n_scope(in that order) as the scope. Both are defined inBaseline::I18nScopes, but might be overwritten in the controller. When inside a section generated with thesectionhelper,section_i18n_scopemight be an even better option. - Always use
|-for multi-line strings in I18n files. - For translated text in views that consists of one or more paragraphs, use the
md_to_htmlhelper, e.g.md_to_html t(:text, scope: action_i18n_key). - When moving text from a view to I18n, first determine the language of the text in the view, move each text fragment to the corresponding namespaced I18n file, and then translate each fragment into the other locales used in the namespace and add them to the correct I18n files.
- Don't use automatic safe HTML rendering with the
_htmlpostfix. Use the explicitmd_to_htmlhelper instead if the text fragment includes HTML. - Prefer Markdown links to passing HTML anchor elements to I18n with the
link_tohelper. Add{:target="_blank"}to the Markdown link if it open in a new tab/window. - Prefer these I18n keys:
headlinefor headlines,textfor the main text of the page or section,ctafor the text of a call to action (often a button or link). If text needs to be broken up into several I18n keys, usetext_1,text_2, etc. If none of these are a good match, check the locale files for keys that have been previously used for similar text fragments. - Prefer simple names for interpolation attributes:
name,url,cta, etc. When in doubt, check the locale files for interpolation attributes that have been previously used. - Don't use quotes for I18n values, unless they contain a colon.
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です