Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
Railsã¢ããªãä½æããéãvalidateã®ã¡ãã»ã¼ã¸ãããã¿ã³ã®æè¨ãªã©ã¯é常è±èªã§è¡¨ç¤ºããã¦ãã¾ãï¼viewã®éå½¢ãè±èªã§ããããã§ããâ¦ï¼ æ¥æ¬äººãªã®ã§ãå½ç¶æ¥æ¬èªè¡¨ç¤ºã«ã¯ãããã¨ããã§ããããã®ã¾ã¾åãè¾¼ãã§ãã¾ãã®ã¯ããã¯ãä¿å®æ§ã«æ¬ ãã¾ããä½æãã人ã«ãããæè¨ã®æºããªã©ãçºçããã®ãåé¡ã§ãã ã¾ããå¤è¨èªå対å¿ãè¦éã«ããã¨ãåãç»é¢ãè¨èªã«åããã¦ä½æããã®ããä¿å®æ§ã«æ¬ ãã¾ãã Railsã®å¤è¨èªå対å¿ãçãè¾¼ã¿ã¾ãã Wikipediaã«ãã㨠æ å ±å¦çã«ãããå½éåã¨å°ååï¼ããããã 㨠ã¡ãããï¼ã¯ãã½ããã¦ã§ã¢ãéçºããç°å¢ã¨ã¯ç°ãªãç°å¢ãç¹ã«å¤å½ãç°æåã«é©åãããæ段ã§ããã å½éåï¼ã¢ã¡ãªã«è±èª: internationalization ã¤ã®ãªã¹è±èª: internationalisationãi18n) ã¯ãã½ããã¦ã§ã¢ã«æè¡çãªå¤æ´ãå ãããã¨
rails6ã§rails-i18nã使ç¨ãã¦ããã©ã¡ã¼ã¿ã¼ã§è¡¨ç¤ºããè¨èªãåãæ¿ãã¦å¤è¨èªå¯¾å¿ãè¡ãã¾ã§ã®æé ãè¨è¿°ãã¦ã¾ããRailsã®ãã¼ã¸ã§ã³ã¯6.1.1ã使ç¨ãã¦ã¾ãã ç°å¢ OS CentOS Linux release 7.9.2009 (Core)Ruby 2.7.2Rails 6.1.1rbenv 1.1.2-40-g62d7798 rails-i18nã¤ã³ã¹ãã¼ã« Gemfileã«ä»¥ä¸ã追å ãã¦ã
ç°å¢ rails 5.2 ruby 2.5 æ¹é ã§ããã ãæ軽ã«æ¥è±å¯¾å¿ æ¦è¦ è¨èªåãæ¿ããã¿ã³ããããã¼ã«è¨ç½® ã³ã³ããã¼ã©ã¼å ã§ã»ãã·ã§ã³å¤æ°session[:locale]ãªã©ã«ãã±ã¼ã«æ å ±ãæ ¼ç´ before_action ã§åãã¼ã¸èªã¿è¾¼ã¿åã«è¨èªè¨å® ymlãã¡ã¤ã«ã¸è¨³æè¨å ¥ Viewãªã©ã§ä½¿ç¨ å®è£ 1. è¨èªåãæ¿ããã¿ã³ããããã¼ã«è¨ç½® ç°¡åã«åãæ¿ããã§ããããã«ãããã¼ã«ãã¿ã³è¨ç½®ãã¾ããã ãããã¼ã«ä»¥ä¸ãè¨ç½® <% if session[:locale] == "en" || session[:locale].blank? %> <%= link_to "/home/change_language/ja" do %> æ¥æ¬èª <% end %> <% elsif session[:locale] == "ja" %> <%= link_to "/home/ch
ããã«ã¡ã¯ããã¼ãã¼ã¨ã³ã¸ãã¢ã®ãããã§ãã æ¢åã®Railsã¢ããªãå½éåã¢ããªã«ã¬ãã«ã¢ããï¼ãã¼ã«ã©ã¤ãºï¼å¤è¨èªåï¼ããããï¼ Railsã¢ããªæ¨æºã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ãè±èªã ããæ¥æ¬èªåãããï¼ ã¨ãããã¨ã§Rails I18nãç¨ãã¦å¤è¨èªåã«å¯¾å¿ããããã®æºåãè¡ãã¾ãã åºæ¬çã«Railsã¬ã¤ãã®Rails å½éå (i18n) APIã«æ²¿ã£ãå 容ã§ãã ä»åã¯ã https://www.foo.com/bar?locale=ja ã¨ããURL paramsãå ã«ç¿»è¨³è¨èªãå¤å¥ããæ¹æ³ãé¸æãã¾ãã æ¦ç¥ å¿ è¦ãã¡ã¤ã«ãä½æ Gemã®ã¤ã³ã¹ãã¼ã« è¨å®ã®æ¸ã込㿠ç°å¢ $ rails --version Rails 5.2.4.2 $ ruby --version ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin1
ãCSSãã§iframeè¦ç´ ãã¬ã¹ãã³ã·ã対å¿ãããã¾ãã¯ãCSSã§iframeè¦ç´ ãã¬ã¹ãã³ã·ã対å¿ãããæ¹æ³ã説æãã¾ããCSSãªã³ãªã¼ã§ãã¬ã¹ãã³ã·ã対å¿ããããã¨ãã§ãã¾ãã以ä¸ã®YouTubeã®åç»ã¯iframeè¦ç´ ã¨ãªã£ã¦ãã¾ãããããã説æããCSSã§ã¬ã¹ãã³ã·ã対å¿ããã¦ãã¾ãã Design for a Mobile MindHTML â iframeè¦ç´ ãã©ããããHTMLã®æ¹ã§ã¯ãã¬ã¹ãã³ã·ã対å¿ããããiframeè¦ç´ ãdivè¦ç´ ãªã©ã§ã©ãããã¾ããããããã«classå±æ§ãªã©ã§ååãã¤ãã¾ããiframeè¦ç´ ã¯ã§ããããµã¤ãºã®æå®ããã¦ããã¾ãã <div class="iframe-wrapper"> <iframe width="560" height="315" src="https://www.youtube.com/embed/xqviGwyy7y0?r
ç®ç æ¥æ¬èªå対å¿ããæã®ã¡ã¢ ä»å¾ãrailsãå¦ã¶æ¹ã«åãã¦ã®åèã«å½¹ç«ã¦ãã æ¡ä»¶ ruby 2.5.1 Rails 5.0.7 ãªã¹ã ããã©ã«ãã®è¨èªãæ¥æ¬èªã«è¨å®ãã gem 'rails-i18n'ãã¤ã³ã¹ãã¼ã« è¤æ°ã®ãã±ã¼ã«ãã¡ã¤ã«ãèªã¿è¾¼ã¾ããããpathãéã config/locales以ä¸ã«ãã±ã¼ã«ãã¡ã¤ã«ãé ç½® ja.ymlã«æ¥æ¬èªãè¨å®ãã è¨å®ããæ¥æ¬ã表示ããã æ§ã ãªè¨è¿°æ¹æ³ 1. ããã©ã«ãã®è¨èªãæ¥æ¬èªã«è¨å®ãã require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) module BoardApp class Application < Rails::Application config.time_zone = 'Tokyo' config.active_
ããªãã®ã¦ã§ããµã¤ãã¯æ¥æ¬èªã ãã§æ¸ããã¦ãã¾ãããï¼ ç¬¬4å ãã¤ãµã¤ãRuby on Railsåå¼·ä¼@ãã¹ãã¹ã«åå ãã¦ãè¨èªåãæ¿ããã§ããã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãRails 4ã§ä½ãã¾ããã è¨èªãåãæ¿ãããã¨ãã§ããã¦ã§ãã¢ããªã¨ã¯ï¼ ä»åä½ã£ãã¦ã§ãã¢ããªã¯ãã¢ã¯ã»ã¹ããURLã«å¿ããè¨èªã®ã³ã³ãã³ãã表示ãã¾ããä¾ãã°ãã«ã¼ããã¹ã«ã¢ã¯ã»ã¹ããã¨ãããã©ã«ãè¨èªã§ããæ¥æ¬èªã®ã³ã³ãã³ãã表示ããã¾ããããã©ã«ãè¨èªä»¥å¤ã®ã³ã³ãã³ãã¯ãä»»æã®è¨èªã³ã¼ãããã¹ã«å«ããã¨è¡¨ç¤ºããã¾ããè¨èªã®ã³ã¼ãã¯ãISO 639-1ã³ã¼ããå ã«è¨å®ãã¾ããã 以ä¸ã«è¨èªã¨URLã®é¢ä¿ã¨ãæ稿ä¸è¦§ã表示ããURLã®ä¾ã示ãã¾ãã è¨èª URL æ稿ä¸è¦§ã表示ããä¾
ã¯ããã« Railsã®ããã©ã«ãè¨èªã®æ¥æ¬èªåï¼2ãã¿ã¼ã³ï¼ å¤è¨èªã®ymlãã¡ã¤ã«ãå°å ¥(2ãã¿ã¼ã³) config/localesã§é層çã«å¤è¨èªãã¡ã¤ã«ã®ç®¡ç çè ã®ã¹ãã㯠Railså¦ç¿æ´ï¼4ã¶æ æ¡ä»¶ Rails 6.0.3.2 Ruby 2.6.6 ãã®ããééããªã©ãããå¯è½æ§ãããã®ã§éµåã¿å³ç¦! Railsã®ããã©ã«ãè¨èªã®æ¥æ¬èªåï¼2ãã¿ã¼ã³ï¼ ã©ã¡ããçæ¹ã®è¨å®ã§æ¥æ¬èªã®è¨èªè¨å®ã¯å®äºãã¾ãã 1. config/application.rbã«è¨å®æ å ±ã追å config/application.rbã«config.i18n.default_locale = :jaãè¨å ¥ãããã¨ã§æ¥æ¬èªãå©ç¨ã§ãã¾ãã :jaã®é¨åãä»ããã¼ã±ã«ãã¼ã«å¤ãããã¨ã§ä»ã®è¨èªã«è¨å®ãããã¨ãã§ãã¾ãã
ååã¯ãã°ã¤ã³æ©è½ã®å®è£ ãè¡ãã¾ããããä»åã¯ãããæ¥æ¬èªåãã¦ããããã¨æãã¾ãã ããã©ã«ãã®ãã±ã¼ã«ãè¨å®ãã deviseã®ãã¼ã¸ã«æ¹æ³ãæ¸ãã¦ããã®ã§ãããã©ããã«ãã£ã¦ããã¾ãã I18n · plataformatec/devise Wiki · GitHub config/application.rb ã«ããã©ã«ãã®ãã±ã¼ã«ãè¨å®ãã¾ãã config.i18n.default_locale = :ja ããã©ã«ãã§ä½ãè¨å®ããã¦ããå ´åã¯ä¿®æ£ãã¦ãã ããã æ¥æ¬èªåãã¡ã¤ã«ãè¨å®ãã config/locales/devise.ja.yml ã¨ãããã¡ã¤ã«ãä½æããä¸è¨ãã¼ã¸ã«ããæ¥æ¬èªç¿»è¨³ãã¡ã¤ã«ãã³ãããã¾ãã # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? æ¬è¨äºã¯ä¸è¨ã®tweetããå§ã¾ãã¹ã¬ããã«è§¦çºããã@qnighyã@na4zagin3ããã¢ã¤ãã£ã¢ãæåãã¦æ¸ããã i18nåãæå¼·ã®å½ã¯å½å ã«è¤æ°ã®è¨èªãããããã®ãã¡ããã¤ãã¯ä»å½ã§ã使ããã¦ããè¨èªã®æ¹è¨ã§ã1ãã¤ãæåã§ã®ä»£æ¿è¡¨è¨ãå°é£ã§ãæ´å²çã«ISO-2022ãã¼ã¹ã®æåã³ã¼ãã¨Unicodeã¨ç¬èªã¨ã³ã³ã¼ãã£ã³ã°ãæ··å¨ãã¦ãã¦ãããªã¬ããªã©ã®ç¹æ®ãªçµçè¦åããããå³æ¸ãå·¦æ¸ã縦æ¸ããä½µç¨ãã â Masaki Hara (@qnighy) 2018å¹´8æ6æ¥ çããã®ãããã§æå¼·ã®i18nå½å®¶ã建è¨ããã¤ã¤ãããä¸
GitHub Pagesã®Webãµã¤ãã¸ã§ãã¬ã¼ã¿ã¼ã§ããJekyllã§è¤æ°è¨èªã®ã³ã³ãã³ãã管çããæ¹æ³ãç´¹ä»ãã¾ããè¤æ°è¨èªã®ã³ã³ãã³ãã管çããã¨ã¯ãä¾ãã°ãè±èªã¨æ¥æ¬èªã®ã³ã³ãã³ããæä¾ãã¦ããWebãµã¤ãã«ã³ã³ãã³ãã追å ã»ä¿®æ£ã»åé¤ããç¶ç¶çã«ã¡ã³ããã³ã¹ããã¨ãããã¨ã§ãã æåã«çµè«ãæ¸ãã¨ãjekyll-task-i18nã使ãã°GitHub Pagesã®ä»çµã¿ããé¸è±ããã«è¤æ°è¨èªã®ã³ã³ãã³ããç¶ç¶çã«ã¡ã³ããã³ã¹ã§ããä»çµã¿ãã§ãã¾ãã è¤æ°è¨èªã®ã³ã³ãã³ãã管çããã¨ãã®åé¡ è¤æ°è¨èªã®ã³ã³ãã³ãã管çããã¨ãã«åé¡ã«ãªããã¨ã¯ãæ å ±ã®ãºã¬ã§ããä¸æ¹ã®è¨èªã§ã¯æä¾ããã¦ããæ å ±ããä»ã®è¨èªã§ã¯æä¾ããã¦ããªãã¨ããç¶æ ã§ããæ å ±ã¯æä¾ããã¦ããããå¤ãæ å ±ã®ã¾ã¾ã¨ãããã¨ãããã¾ãã ãä½ã£ãå¾ã¯å¤æ´ããªããã¨ããWebãµã¤ãã§ã¯ãã¾ãåé¡ã«ãªãã¾ããããä½ã£ãå¾ã
Spring Bootã§ã¯application.propertiesã«è¨å®ãæ¸ãã°MessageSourceã¯ã©ã¹ããå¤è¨èªå¯¾å¿ãããã¡ãã»ã¼ã¸ãè¿ã£ã¦ãããããã ...ããã©ããããªãã¼ã·ã§ã³ã¨ã©ã¼ã¡ãã»ã¼ã¸ã¯å¤è¨èªåãã¦ãããªãã£ãã ç°¡åã«ããæ¹ãã¡ã¢ã£ã¦ããã åä½ç°å¢ Java 8 Spring Boot 1.3.2 å®éã«æ¸ããã³ã¼ã è¨å®ãã¡ã¤ã«ã®ç¨æ ã»ã¼åæè¨å®ã®ã¾ã¾ãè¨èªãã¡ã¤ã«ã¯i18nã®ä¸ã«ç½®ãããã£ãã®ã§ããã ãå¤æ´ã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}