Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RAILS + REACTの実際のサービスでの国際化の話

RAILS + REACTの実際のサービスでの国際化の話

Hiroyuki Shirakawa

June 08, 2017
Tweet

Other Decks in Programming

Transcript

  1. 4K

  2. REACT i18n-js translations layout //= require i18n = javascript_include_tag "locales/#{I18n.default_locale}"

    - unless I18n.locale == I18n.default_locale = javascript_include_tag "locales/#{I18n.locale}"
  3. it '各locale.yml translation 欠落 ' do count = i18n.missing_keys.count unless

    count.zero? missing_list = "以下 locale 未設定 \n" i18n.missing_keys.each do |locale| locale.keys.each do |key| missing_list << "#{locale.key} | #{key}\n" end end fail missing_list end end
  4. YAML ja: # 両方 利用 設定 isomorphic: attributes: car: &isomorphic_attributes_car

    tire: # activerecord: attributes: car: <<: *isomorphic_attributes_car loof: 天井 # js: attributes: car:
  5. : DEVISE Devise::SessionsController flash application_controller class Devise::SessionsController < DeviseController prepend_before_action

    :require_no_authentication, only: [:new, prepend_before_action :allow_params_authentication!, only: :create prepend_before_action :verify_signed_out_user, only: :destroy if authenticated && resource = warden.user(resource_name) flash[:alert] = I18n.t("devise.failure.already_authenticated") redirect_to after_sign_in_path_for(resource) end
  6. DB

  7. DB