Skip to content

Split i18n templates #2955

@goosys

Description

@goosys

I’m a Japanese speaker, and we’ve had to implement a variety of customizations in order to make our application work well in Japanese.
Many of the translate calls in Administrate’s templates are optimized for alphabet-based languages, and they include transformations that are unnecessary (and sometimes undesirable) for us.

As our i18n customizations grew, upgrading Administrate became increasingly painful because we had to manually update many templates to match the latest version.
I’ve been thinking for years about whether there might be a better approach.

So here’s my proposal:
What would you think about splitting the templates in the following way?

  • Extract all translated UI elements into files under administrate/i18n/*.
  • Load them using render partial: ....
  • Application developers can then copy those templates and provide locale-specific versions such as i18n/_resource_item_label.ja.html.erb.
  • Administrate itself would not attempt to support those customized locale templates beyond this mechanism.

This would also address issues like #1783.
If someone wants to apply German-style capitalization, they can simply create a .de.html.erb version and implement it however they like.
There was also a question somewhere about supporting right-to-left languages — with this approach, developers could handle that entirely within their own locale templates.
(For reference, in Japanese we don’t want pluralization or capitalization at all, so we would prefer to use just human_attribute_name with no additional transformations.)

I'd love to hear what you think!

Here is my experiment with this idea:
8b7da90

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions