CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Sun, 17 Aug 2025 06:28:18 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20091227193523
location: https://web.archive.org/web/20091227193523/https://github.com/rails/localization
server-timing: captures_list;dur=2.242548, exclusion.robots;dur=0.026446, exclusion.robots.policy;dur=0.011589, esindex;dur=0.019407, cdx.remote;dur=38.245520, LoadShardBlock;dur=218.818720, PetaboxLoader3.datanode;dur=80.635238, PetaboxLoader3.resolve;dur=29.931456
x-app-server: wwwb-app219
x-ts: 302
x-tr: 311
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app219; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Sun, 17 Aug 2025 06:28:18 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Sun, 27 Dec 2009 19:35:22 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "0cd4f9f8e1f2e6929aacfc82adc47909"
x-archive-orig-x-runtime: 72ms
x-archive-orig-content-length: 23195
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: ibm852
memento-datetime: Sun, 27 Dec 2009 19:35:23 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Thu, 17 Sep 2009 04:17:43 GMT", ; rel="prev memento"; datetime="Sun, 27 Sep 2009 13:16:22 GMT", ; rel="memento"; datetime="Sun, 27 Dec 2009 19:35:23 GMT", ; rel="next memento"; datetime="Thu, 28 Jan 2010 11:17:52 GMT", ; rel="last memento"; datetime="Mon, 12 Oct 2020 10:37:18 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 51_13_20091227141241_crawl102_IndexOnly-c/51_13_20091227193223_crawl101.arc.gz
server-timing: captures_list;dur=0.594031, exclusion.robots;dur=0.023276, exclusion.robots.policy;dur=0.011781, esindex;dur=0.013664, cdx.remote;dur=6.164864, LoadShardBlock;dur=82.602041, PetaboxLoader3.datanode;dur=64.533310, PetaboxLoader3.resolve;dur=69.797076, load_resource;dur=67.305541
x-app-server: wwwb-app219
x-ts: 200
x-tr: 235
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
rails's localization at master - GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (

This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (

Description: | Localization plugin edit |
Homepage: | https://rubyonrails.org edit |
Public Clone URL: |
git://github.com/rails/localization.git
Give this clone URL to anyone.
git clone git://github.com/rails/localization.git
|
Your Clone URL: |
Use this clone URL yourself.
git clone git@github.com:rails/localization.git
|
name | age | message | |
---|---|---|---|
![]() |
CHANGELOG | Sat Oct 29 07:44:21 -0700 2005 | Localization plugin: Added support for 0, 1, ma... [madrobby] |
![]() |
README | Sat Oct 29 07:28:50 -0700 2005 | Added localization plugin [madrobby] |
![]() |
init.rb | Sat Oct 29 09:04:06 -0700 2005 | Use lib/ style [dhh] |
![]() |
lib/ | Sat Oct 29 09:04:06 -0700 2005 | Use lib/ style [dhh] |
README
= Localization Plugin for Rails This plugin provides a simple, gettext-like method to provide 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 == Usage If 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 named like the languages you define in them (but you can put everything in one big file too.) For instance-customizable strings, add overrides in files you put 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, you can 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') } end Create 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 guesstimation You can generate a guesstimation of all strings needed to be translated in your views by first adding the _('blah') syntax everywhere and then calling: puts Localization.generate_l10n_file in the Rails console.
This feature is coming soon. Sit tight!