Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !2114

Add field has_many i18n

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jhang-jhe-wei/main into main Jan 14, 2022
  • Overview 5
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: jhang-jhe-wei

Field::HasMany i18n

How to Use?

If you have ActiveRecord i18n translation of the model you don't need to do anything extra, if not, make an ActiveRecord i18n translation of the model.

Example

The recipe has many recipe items.

app/dashboards/recipe_dashboard.rb

  ATTRIBUTE_TYPES = {
    recipe_items: Field::HasMany,
    id: Field::Number,
    name: Field::String,
    package_spec: Field::String,
    remark: Field::String,
    created_at: Field::DateTime,
    updated_at: Field::DateTime,
  }.freeze

zh-TW.yml

zh-TW:
  activerecord:
    models:
      recipe: 配方表
      recipe_item: 材料

Result

image

材料種類 is defined in helper.label.recipe.recipe_items, it's not the same, don't confuse.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jhang-jhe-wei/main