Rails 的單複數翻譯
        
      WriterShelf™ is a unique multiple pen name blogging and forum platform. Protect relationships and your privacy. Take your writing in new directions. ** Join WriterShelf**
      
        WriterShelf™ is an open writing platform. The views, information and opinions in this article are those of the author.
      
  
          Article info
        
        
              Categories:
            
            
                    
⟩
⟩
                  
            
              Tags:
            
            
              Date:
            
            
              Published: 2017/08/01 - Updated: 2017/10/27
            
          
              Total: 265 words
          
      
              Like
              
              or Dislike
              
            
          About the Author
          很久以前就是個「寫程式的」,其實,什麼程式都不熟⋯⋯
就,這會一點點,那會一點點⋯⋯
        More to explore
      
       
 
 
 
 
 
 
 

這一定要寫下來,就在剛要放棄時,突然仔細看了文件,證明,要看書,不要老是在網路找解答。
Rails 的 I18n 有很好用的翻譯 YAML,以前我都是用條件判斷來做單複數翻譯:
日子照過,今天想要來改成 Rails I18n 自己判斷功能,想所少寫些,結果,搞了20分鐘,就是不動!
為什麼,為什麼,為什麼,為什麼,為什麼⋯⋯
就在要放棄時,看到Rails文件上的一段附註:
為什麼要規定變數名稱啊,不能改名? 所以,改成用Count就好了:
20分鐘又學到:「讀書很重要!」