384 lines
No EOL
9.2 KiB
HTML
Executable file
384 lines
No EOL
9.2 KiB
HTML
Executable file
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<title>File: README</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
|
<script type="text/javascript">
|
|
// <![CDATA[
|
|
|
|
function popupCode( url ) {
|
|
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
}
|
|
|
|
function toggleCode( id ) {
|
|
if ( document.getElementById )
|
|
elem = document.getElementById( id );
|
|
else if ( document.all )
|
|
elem = eval( "document.all." + id );
|
|
else
|
|
return false;
|
|
|
|
elemStyle = elem.style;
|
|
|
|
if ( elemStyle.display != "block" ) {
|
|
elemStyle.display = "block"
|
|
} else {
|
|
elemStyle.display = "none"
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// Make codeblocks hidden by default
|
|
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
|
|
// ]]>
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
|
|
|
|
<div id="fileHeader">
|
|
<h1>README</h1>
|
|
<table class="header-table">
|
|
<tr class="top-aligned-row">
|
|
<td><strong>Path:</strong></td>
|
|
<td>README
|
|
</td>
|
|
</tr>
|
|
<tr class="top-aligned-row">
|
|
<td><strong>Last Update:</strong></td>
|
|
<td>Thu Sep 07 12:03:56 Romance Daylight Time 2006</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<!-- banner header -->
|
|
|
|
<div id="bodyContent">
|
|
|
|
|
|
|
|
<div id="contextContent">
|
|
|
|
<div id="description">
|
|
<p>
|
|
= Localization Simplified (<a
|
|
href="../classes/LocalizationSimplified.html">LocalizationSimplified</a>)
|
|
</p>
|
|
<p>
|
|
Localization Simplified plugin for Ruby on Rails. Really simple
|
|
localization. Written by Jesper Rønn-Jensen ( <a
|
|
href="http://justaddwater.dk">justaddwater.dk</a>/ )
|
|
</p>
|
|
<p>
|
|
The goal is to have a dead simple plugin for one-language (non-english)
|
|
Rails applications. Many of the existing localization /
|
|
internationalization plugins are too big for this and hard to get started
|
|
with. Just dump this plugin in /vendor/plugins/, set your language and off
|
|
you go.
|
|
</p>
|
|
<p>
|
|
Unlike the more advanced plugins, you don’t have to translate
|
|
anything in your view files. Just use the standard Rails commands
|
|
you’re used to.
|
|
</p>
|
|
<p>
|
|
The simple approach also makes limits. Make sure you understand them to
|
|
decide if this plugin is right for you.
|
|
</p>
|
|
<p>
|
|
I use this plugin when creating new projects. Then later in the development
|
|
process I can decide to change to a more advanced localization plugin (if
|
|
necessary)
|
|
</p>
|
|
<h3>What it does</h3>
|
|
<p>
|
|
This plugin modifies the following most used helpers for Rails
|
|
</p>
|
|
<ul>
|
|
<li>Sets UTF-8 content-type HTTP header
|
|
|
|
</li>
|
|
<li>Sets UTF-8 connection to database
|
|
|
|
</li>
|
|
<li>Localized monthnames on date_select etc. (changing the order of Y-M-D,
|
|
where Rails allows)
|
|
|
|
</li>
|
|
<li>Localized <a href="../classes/ActiveRecord.html">ActiveRecord</a> errors
|
|
(and error headings)
|
|
|
|
</li>
|
|
<li>Localized distance_of_time_in_words
|
|
|
|
</li>
|
|
<li>Localized to_currency (but not changing the order of unit/currency)
|
|
|
|
</li>
|
|
<li>Simple pluralization also available in the lang-file (but currently only
|
|
used for pluralizing "error"=>"errors" in local
|
|
language)
|
|
|
|
</li>
|
|
<li>Uses standard Rails methods. In this way, there is no tedious rewrite of
|
|
localization functions in your view files
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Limitations</h3>
|
|
<ul>
|
|
<li>More advanced features are not likely to be available here.
|
|
|
|
</li>
|
|
<li>No translation of models or the like.
|
|
|
|
</li>
|
|
<li>If you want support for multiple languages, use another L10N/I18n plugin,
|
|
like GLoc or Globalize
|
|
|
|
</li>
|
|
<li>No support for re-ordering datetime_select fields or currency indicators.
|
|
But date_select IS re-ordered. Currently, Rails lacks support of :order on
|
|
these, but it can be done fairly easy and is already implemented in other
|
|
frameworks.
|
|
|
|
</li>
|
|
</ul>
|
|
<p>
|
|
The reason why I have not reordered the datetime_select fields or currency
|
|
is that it will introduce an unnecessary dependency here (because functions
|
|
have to be recoded).
|
|
</p>
|
|
<h3>Supported languages</h3>
|
|
<p>
|
|
Currently supported languages:
|
|
</p>
|
|
<ul>
|
|
<li>English (for running test cases and comparing to normal texts)
|
|
|
|
</li>
|
|
<li>German
|
|
|
|
</li>
|
|
<li>Spanish
|
|
|
|
</li>
|
|
<li>French
|
|
|
|
</li>
|
|
<li>Dutch
|
|
|
|
</li>
|
|
<li>Danish
|
|
|
|
</li>
|
|
<li>Swedish
|
|
|
|
</li>
|
|
<li>Finnish
|
|
|
|
</li>
|
|
<li>Canadian French
|
|
|
|
</li>
|
|
<li>Swedish Chef, and Pirate talk (just for the fun of it)
|
|
|
|
</li>
|
|
<li>any other language you want. Just dump your translation in the /lib folder
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Download code</h3>
|
|
<ul>
|
|
<li>Project homepage: <a
|
|
href="http://rubyforge.org/projects/l10n-simplified">rubyforge.org/projects/l10n-simplified</a>/
|
|
|
|
</li>
|
|
<li>Subversion access: svn checkout svn://rubyforge.org/var/svn/l10n-simplified
|
|
|
|
</li>
|
|
<li>Browse: <a
|
|
href="http://rubyforge.org/plugins/scmsvn/viewcvs.php/?root=l10n-simplified">rubyforge.org/plugins/scmsvn/viewcvs.php/?root=l10n-simplified</a>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Usage:</h3>
|
|
<p>
|
|
in init.rb, set your language. That’s it. Now your db connection is
|
|
running UTF-8 and standard Rails output is localized.
|
|
</p>
|
|
<p>
|
|
If your view files contains text, you probably also want to save your files
|
|
as UTF-8.
|
|
</p>
|
|
<h3>Installation:</h3>
|
|
<p>
|
|
1) Just copy this plugin into your /vendor/lib folder 2) Choose your
|
|
lang-file in init.rb (default is Danish because I am Danish)
|
|
</p>
|
|
<p>
|
|
A special note of WARNING: All files here are saved using UTF-8 encoding.
|
|
It’s not required for working, I guess, but other encodings could
|
|
bring you in trouble.
|
|
</p>
|
|
<h3>TODO</h3>
|
|
<ul>
|
|
<li>Rake task that modifies all view-files and converts them to UTF-8
|
|
|
|
</li>
|
|
<li>Also a task that modifies all generators to use UTF-8
|
|
|
|
</li>
|
|
<li>Other helpers that need modification? (your suggestions and contributions
|
|
are welcome)
|
|
|
|
</li>
|
|
<li>Add more test cases to verify it works properly
|
|
|
|
</li>
|
|
<li>Modify to_boolean_select_tag with localized true/false?? (normally, I would
|
|
prefer to use a checkbox for this and NOT a select tag)
|
|
|
|
</li>
|
|
<li>Verify that the lang-files supplied are relevant
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>DONE</h3>
|
|
<ul>
|
|
<li>Added comments in all lang-files, thanks Jarkko Laine for the idea
|
|
(2006-09-07)
|
|
|
|
</li>
|
|
<li>Bugfix: Replaced hardcoded string in distance_of_time_in_words when
|
|
:include_seconds was false (2006-08-30)
|
|
|
|
</li>
|
|
<li>Added Canadian French translation (thanks Daniel) (2006-08-25)
|
|
|
|
</li>
|
|
<li>Added comments in lang-file for documentation of how to localize
|
|
(2006-08-25)
|
|
|
|
</li>
|
|
<li>Added French translation (thanks Fred Cavazza) (2006-08-25)
|
|
|
|
</li>
|
|
<li>Added Finnish translation (thanks Jarkko Laine) (2006-08-25)
|
|
|
|
</li>
|
|
<li>Bugfix re-added HTTP header for UTF-8. Necessary for some lang-files
|
|
(2004-08-24)
|
|
|
|
</li>
|
|
<li>Renamed test files to make rake test command work (2006-08-23)
|
|
|
|
</li>
|
|
<li>Localized time "Wed Aug 23 12:38:22 Romance Daylight <a
|
|
href="../classes/Time.html">Time</a> 2006" =>
|
|
|
|
<pre>
|
|
"onsdag d. 23 august 2006 12:38:22" (Danish)
|
|
</pre>
|
|
</li>
|
|
<li>Reordering of date_select fields (2006-08-23)
|
|
|
|
</li>
|
|
<li>Test that plugin works with the Rails version it is installed next to
|
|
(2006-08-20)
|
|
|
|
</li>
|
|
<li>Added Dutch translation lang_nl.rb, thanks to Jeroen Houben (2006-08-20)
|
|
|
|
</li>
|
|
<li>Added Pirate language lang_pirate.rb, thanks to Tobias Michaelsen
|
|
(2006-08-18)
|
|
|
|
</li>
|
|
<li>Added <a href="../classes/Date.html">Date</a> and Time#to_formatted_s with
|
|
locale specific strings (2006-08-18)
|
|
|
|
</li>
|
|
<li>Added MIT-license, copied from Ruby on Rails (2006-08-13)
|
|
|
|
</li>
|
|
<li>Added tests for plugin (2006-08-13)
|
|
|
|
</li>
|
|
<li>Localized version of <a
|
|
href="../classes/Array.html#M000002">Array.to_sentence</a> (2006-08-09)
|
|
|
|
</li>
|
|
<li>Added test scaffold (2006-08-09)
|
|
|
|
</li>
|
|
<li>Added swedish language, thanks to Olle Jonsson (2006-08-09)
|
|
|
|
</li>
|
|
<li>Localized version of to_currency helper (2006-08-07)
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Your help</h3>
|
|
<p>
|
|
Feel free to use, translate, modify and improve this code. Do send me
|
|
translations, improvements, etc. I cannot promise to use it, but chances
|
|
are that I will unless it bloats the code here completely or makes code
|
|
harder to maintain.
|
|
</p>
|
|
<p>
|
|
I added FIXME notes in the code to indicate where I also could use help.
|
|
</p>
|
|
<h3>Credits</h3>
|
|
<p>
|
|
This plugin uses a few bits and pieces from other Rails plugins GLoc (<a
|
|
href="http://rubyforge.org/projects/gloc">rubyforge.org/projects/gloc</a>/)
|
|
and swe_rails (<a
|
|
href="http://opensource.ki.se/swe_rails.html">opensource.ki.se/swe_rails.html</a>)
|
|
</p>
|
|
<p>
|
|
Created 2006-07-28 by Jesper Rønn-Jensen <a
|
|
href="http://justaddwater.dk">justaddwater.dk</a>/
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- if includes -->
|
|
|
|
<div id="section">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- if method_list -->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="validator-badges">
|
|
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |