Hi,
You need to accsess:
http://localhost:7001/foo?lang=de_DE
Or,
I recommand to use po/de/ directroy instead of po/de_DE/.
Ruby-GetText searchs the target mo files using lang
value such as "de_DE".
If you set lang = "de_DE", Ruby-GetText search:
1. locale/de_DE/myapp.mo
2. locale/de/myapp.mo
If you set lang = "de", Ruby-GetText search:
1. locale/de/myapp.mo
So, "de" is more general to put your po/mo files.
On Fri, 28 Oct 2005 17:41:52 +0200
Torkel Holm <torkel-ts6Mub3wUGdhl2p70BpVqQ@public.gmane.org> wrote:
> Hi,
>
> I have followed the instructions from
> http://manuals.rubyonrails.com/read/chapter/105
> to set up an i18n app with Rails 0.14.2 and Gettext 1.0.0,
> but the strings doesnt get translated.
>
> Any troubleshooting tips appreciated.
>
> Some of the methods I tried was:
> http://localhost:7001/foo?lang=de
> @session[:lang] = "de"
>
"HTTP_ACCEPT_LANGUAGE"=>"de,nb;q=0.8,en-us;q=0.5,en;q=0.3"
>
> ,----
> | <!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="<%= Locale.get %>" lang="<%= Locale.get
%>">
> | <head>
> | <title>Title page</title>
> | <meta http-equiv="content-type" content="text/html;
charset=<%= Locale.charset %>" />
> | </head>
> | <body>
> |
> | <%= _("Hello") %>
> | </body>
> | </html>
> `----
>
> => Source
>
> ,----
> | <!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="de" lang="de">
> | <head>
> | <title>Title page</title>
> | <meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1" />
> | </head>
> | <body>Hello</body>
> | </html>
> `----
>
>
> The application controller is standard:
> ,----
> | require ''gettext/rails''
> | GetText.output_charset = "UTF-8"
> |
> | class ApplicationController < ActionController::Base
> | before_filter :init_gettext
> | def init_gettext
> | bindtextdomain("myapp", request.cgi) # You need to pass
CGI object first.
> | @headers["Content-Type"] = "text/html;
charset=UTF-8"
> | end
> | end
> `----
>
> PO-file
> ,----[ po/de_DE/myapp.po ]
> | # SOME DESCRIPTIVE TITLE.
> | # Copyright (C) YEAR THE PACKAGE''S COPYRIGHT HOLDER
> | # This file is distributed under the same license as the PACKAGE package.
> | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
> | #
> | msgid ""
> | msgstr ""
> | "Project-Id-Version: 0.1\n"
> | "POT-Creation-Date: 2005-10-28 16:49+0200\n"
> | "PO-Revision-Date: 2005-10-28 16:52+0200\n"
> | "Last-Translator: Anonymous
<contact-uOSbDDts8XEjmeHxeUldvw@public.gmane.org>\n"
> | "Language-Team: German\n"
> | "MIME-Version: 1.0\n"
> | "Content-Type: text/plain; charset=UTF-8\n"
> | "Content-Transfer-Encoding: 8bit\n"
> | "Plural-Forms: nplurals=1; plural=0;\n"
> |
> | msgid "Hello"
> | msgstr "Guten Morgen"
> `----
>
> script/localize
>
> locale
> |-- de_DE
> | `-- LC_MESSAGES
> | `-- myapp.mo
> `-- en_US
> `-- LC_MESSAGES
> `-- myapp.mo
>
> --
> Torkel Holm, Norway
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
--
.:% Masao Mutoh<mutoh-+e5RZkbjevhHfZP73Gtkiw@public.gmane.org>