⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 用ruby on rails写的一个博客程序,还不错..ruby on rails的确是个好框架
💻
字号:
= Localization Plugin for RailsThis plugin provides a simple, gettext-like method toprovide localizations.== Features * Any number of languages or locales * Simple method to defines singluar/plural translations * Can use lambdas to provide Ruby-code based dynamic translations * Customizable for different instances of the application== UsageIf the localization plugin is installed, it is used automatically.You need to create a /lang dir in your RAILS_ROOT.The recommended way to use it is to create files that are namedlike the languages you define in them (but you can put everything inone big file too.)For instance-customizable strings, add overrides in files youput in /lang/custom.=== Simple example:Create a file /lang/translations.rb:    Localization.define('de') do |l|    l.store 'yes', 'Ja'    l.store 'no', 'Nein'  end    Localization.define('fr') do |l|    l.store 'yes', 'oui'    l.store 'no', 'non'  end  In your controller or application.rb:  Localization.lang = 'de' # or 'fr'  In your view:  <%=_ 'yes' %>  <%=_ 'no' %>  Because the _ method is simply an extension to Object, youcan use it anywhere (models/controllers/views/libs).  === Extended example:Create a file /lang/default.rb with following contents:    Localization.define do |l|    l.store '(time)', lambda { |t| t.strftime('%I:%M%p') }  endCreate a file /lang/de_DE.rb with following contents:    Localization.define('de_DE') do |l|    l.store '%d entries', ['Ein Eintrag', '%d Einträge']    l.store '(time)', lambda { |t| t.strftime('%H:%M') }  end  In your controller or application.rb:    Localization.lang = 'de_DE'In your view:  <%=_ '%d entries', 1 %>     # singular variant is chosen   <%=_ '%d entries', 4 %>     # plural variant is chosen  <%=_ '(time)', Time.now %>  # call the block with a parameter  == Translation file guesstimationYou can generate a guesstimation of all strings needed to betranslated in your views by first adding the _('blah') syntaxeverywhere and then calling:  puts Localization.generate_l10n_file  in the Rails console.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -