Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
These are some tips based on my experiences of working with Rails i18n, extracted from my styleguide. Avoid translated view files If you ever need to work with external translators, itâs a bit of a pain sending both your YML files and a bunch of views like index.en.html.erb. For one thing, you need some code to find all those files and send them, and put them back after receiving the translations.
å¤è¨èªãµã¤ããä½ã£ã¦ãã¦ããã¹ã¿ãã¼ã¿ãå¤è¨èªåããããã§ããã®ããã«ãã¼ãã«å¢ãããããã©ã°ã¤ã³å ¥ããã»ã©ã®ãã®ã§ããªãã»ã»ã»ã¨ãã£ãã¨ãã«ãç°¡åã«ã«ã©ã ãã¼ã¿ãå½éåï¼i18nï¼ã§ãããã«ãã¼ã§ãã ãã¨ãã°ããã©ã³ã¯ãã¨ããæ©è½ããã£ã¦ãã¦ã¼ã¶ã¯beginner, intermediate, seniorã®ã©ããã«å±ãããããªã¨ãã以ä¸ã®ãããªã·ã³ãã«ãªãã¼ãã«ãä½ããUserã¯Rankã«belongs_toããã¨ãã¾ãã DBã«ã¯ãè±èªã®æååã§ãå ¥ãã¦ããã¾ãã create_table :ranks do |t| t.string :name end 以ä¸ã®ãããªãã«ãã¼ãä½ã£ã¦ããã¾ãã #lib/acts/column_i18n.rb #localizableã¨ãã®ã»ããæ ¼å¥½ãããããã¾ãã¾ä»ã§ä½¿ã£ã¦ããã®ã§ããã¶ããªãããã«å¤ãªååã«ãã module Acts::Col
Rails 3.2ã§ãã¹ãããã¢ãã«ã®å±æ§åãI18nã§ç¿»è¨³ããã ä¸è¨ã®ããã«ãããã¢ãã«ãaccepts_nested_attributes_forã§ä»ã®ã¢ãã«ã®å±æ§ãåãåããããã«ãã¦ããå ´åãUserãæã¤postsã®å±æ§åãããªãã¼ã·ã§ã³ãªã©ã§å½éåãããããã«ããã«ã¯config/locales/*.ymlã§ã ã®ãããªé層ãå®ç¾©ããã°ããã Issue #1869: Rails 3.1 nested I18n namespace deprecations · rails/rails
ã¯ããã¦ã®Cucumberã§ä½¿ç¨ããã¦ããi18n_generatorsã ä¹ ãã¶ãã«ä½¿ããã¨ãã©ããã£ã¦installãããã ã£ãã¨æ¤ç´¢ããã¨ã amatsuda-i18n_generatorsã£ã¦ååãåºã¦ãã¦ããã¡ãããã£ããã¤ã³ã¹ãã¼ã«ãã¦ãã¾ãã¾ããã çµæãå¤æ£ããåããªãã1æéã»ã©æ¶çµ¶ãã¦ã¾ããã versionï¼ã¨ãhistory.txtï¼è¦ãã¨æ°ä»ããã ãã© i18n_generatorsï¼1.0.2 amatsuda-i18n_generatorsï¼0.6.0 ã¨ãªã£ã¦ãã¦ãamatsuda-i18n_generators ã¯ã¡ã³ããã³ã¹ããã¦ããªãã®ã§ i18n_generatorsã使ç¨ãã¾ãããã 使ãæ¹ ã¨ã¦ãç°¡åã§ãã rails g i18n jaãï¼rails3ï¼ script/generate i18n jaãï¼rails2ï¼ config/local
Rails 2.2ããi18nã¨ããå½éåã®æ©è½ãã¤ãã¾ãããGetTextãããããããããªããã¨æã£ã¦ãã¾ããæ¨æºæ©è½ã ããã¾ãã¯ãvalidationã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ãæ¥æ¬èªåãã¦ã¿ã¾ãããã æ®éã«ããã¨æ¥æ¬èªã®å®ç¾©ãã¡ã¤ã«ãä½ãã®ãé¢åã§ããããã§ããã¡ã¤ã«ãèªåçæãã¦ãããgemã使ãã¾ãã # gem so -a http://gems.github.com # gem i amatsuda-i18n_generators ã§ãmodelãä½ã£ã¦ãdb:migrateããå¾ãããã§ã $ script/generate i18n ja config/locales/ja.ymlãçæããã¾ããä¸èº«ãè¦ã¦ã¿ãã¨ãè¥å¹²ãæ¥æ¬èªããã³ãé©å®ä¿®æ£ã ããã ãã§ãvalidationã¨ã©ã¼ã¡ãã»ã¼ã¸ãæ¥æ¬èªåãããã®ã§ãããmodelåã¨attributeåãè±èªã®ã¾ã¾ã§ããcon
Tuesday, September 21, 2010 詳ããã¯ãã¡ãã® å ¬å¼ããã¥ã¡ã³ã ããã ãã£ã¨è¦ãéããi18n å¨ã㯠rails2 ãã極端ã«å¤§ããªå¤æ´ã¯è¦ãããªããt ã¡ã½ãã㨠l ã¡ã½ããã£ã¦ rails2 ç³»ããå¥ã ã ã£ãã£ãï¼ãå ¨é¨ t ã¡ã½ããã ã£ããããªæ°ãããããã©ã¼ãããå¨ã㯠l ã¡ã½ãããã«ã©ã ãªã©ããæã£ã¦ãããã®ã¯ t ã¡ã½ããã¿ãããªãã£ããããè¦ãæ¹ã§å¤§ä¸å¤«ããªï¼ åç´ã«è¨èªãå ¥ãæ¿ãããå ´åã¯ãRAILS_ROOT/config/local/ja.yml ãã¡ã¤ã«ãç¨æãã¦ãRAILS_ROOT/config/application.rb ã以ä¸ã®ããã«ä¿®æ£ããã # config.i18n.default_locale = :de â config.i18n.default_locale = :ja ã§ãèå¿ã® ja.yml ãªã®ã ããã©ã
楽天ãã¯ããã¸ã¼ã«ã³ãã¡ã¬ã³ã¹2008ã§LTããã¨ãã®ã¹ã©ã¤ãã i18n_generatorsã¨ããRails 2.2ç¨èªä½ã©ã¤ãã©ãªã®ç´¹ä»ãRead less
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}