upmin / upmin-admin-ruby

Framework for creating powerful admin backends with minimal effort in Ruby on Rails.
MIT License
755 stars 66 forks source link

I18n support #95

Open doabit opened 9 years ago

doabit commented 9 years ago

Would Upmin Admin support i18n?

joncalhoun commented 9 years ago

Currently it does not. What is your use case for this?

Specifically, do you intend to have multiple languages available at once, or just one language and you want to change that in a config or something similar?

doabit commented 9 years ago

I want to custom some messages. https://github.com/upmin/upmin-admin-ruby/blob/master/app/views/upmin/models/dashboard.html.haml#L7, i think it should like I18n.t("upimin-admin..embarrassing")

mibamur commented 9 years ago

Hello to everyone.

My point of view.

1) translation

applicaton.rb

    config.i18n.default_locale = :ru

config/locales/ru.bootstrap.yml

# Sample localization file.

ru:
  helpers:
    actions: "Действия"
    links:
      back: "Назад"
      cancel: "Отмена"
      confirm: "Уверены?"
      destroy: "Удалить"
      new: "Создать"
      edit: "Изменить"
      save: "Сохранить"
      show: "Смотреть"
    titles:
      edit: "Изменить %{model}"
      save: "Сохранить %{model}"
      new: "Создать %{model}"
      delete: "Удалить %{model}"
    select:
      prompt: "Выберите: "
    submit:
      create: "Создать %{model}"
      submit: "Сохранить %{model}"
      update: "Сохранить %{model}"

in the view (haml example)

.col-sm-4
            = f.submit t('.save', :default => t("helpers.links.save")), :class => "btn btn-primary"
2) locales

date (format view) , time (24 format or not) and something else will changes from Locale to Locale

PS Instrument helps solve this question fully:

gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'master'
gem "i18n-js", github: "fnando/i18n-js", branch: 'master'
gem 'i18n-tasks', github: 'glebm/i18n-tasks'
mibamur commented 9 years ago

So, I can help and do it.