gettext 1.0.0-mswin32 → 1.1.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +193 -0
- data/NEWS +51 -1
- data/README +29 -11
- data/Rakefile +70 -56
- data/bin/rgettext +2 -0
- data/bin/rmsgfmt +2 -0
- data/bin/rmsgmerge +24 -0
- data/data/locale/cs/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
- data/ext/gettext/gettext/_locale.BAK +86 -0
- data/ext/gettext/gettext/_locale.c +1 -1
- data/ext/gettext/gettext/_locale.exp +0 -0
- data/ext/gettext/gettext/_locale.lib +0 -0
- data/ext/gettext/gettext/_locale.obj +0 -0
- data/ext/gettext/gettext/_locale.pdb +0 -0
- data/ext/gettext/gettext/_locale.so +0 -0
- data/ext/gettext/gettext/mkmf.log +4 -4
- data/ext/gettext/gettext/vc70.pdb +0 -0
- data/lib/_locale.so +0 -0
- data/lib/gettext.rb +17 -4
- data/lib/gettext/cgi.rb +34 -19
- data/lib/gettext/locale.rb +3 -13
- data/lib/gettext/locale_default.rb +2 -2
- data/lib/gettext/locale_win32.rb +27 -7
- data/lib/gettext/mo.rb +6 -1
- data/lib/gettext/parser/activerecord.rb +115 -0
- data/lib/gettext/parser/glade.rb +3 -1
- data/lib/gettext/parser/ruby.rb +56 -57
- data/lib/gettext/poparser.rb +297 -0
- data/lib/gettext/rails.rb +161 -3
- data/lib/gettext/rgettext.rb +19 -9
- data/lib/gettext/rmsgfmt.rb +95 -363
- data/lib/gettext/rmsgmerge.rb +381 -0
- data/lib/gettext/string.rb +26 -0
- data/lib/gettext/textdomain.rb +21 -18
- data/lib/gettext/utils.rb +55 -0
- data/lib/gettext/version.rb +1 -1
- data/po/cs/rails.po +83 -0
- data/po/cs/rgettext.po +104 -0
- data/po/de/rails.po +79 -0
- data/po/de/rgettext.po +72 -21
- data/po/es/rails.po +80 -0
- data/po/es/rgettext.po +75 -19
- data/po/fr/rails.po +81 -0
- data/po/fr/rgettext.po +75 -19
- data/po/it/rgettext.po +68 -17
- data/po/ja/rails.po +78 -0
- data/po/ja/rgettext.po +71 -20
- data/po/ko/rails.po +77 -0
- data/po/ko/rgettext.po +74 -22
- data/po/nl/rails.po +80 -0
- data/po/nl/rgettext.po +102 -0
- data/po/pt_BR/rails.po +79 -0
- data/po/pt_BR/rgettext.po +77 -24
- data/po/rails.pot +80 -0
- data/po/rgettext.pot +63 -13
- data/po/sv/rgettext.po +63 -15
- data/samples/cgi/cookie.cgi +5 -0
- data/samples/cgi/helloerb1.cgi +4 -0
- data/samples/cgi/helloerb2.cgi +5 -0
- data/samples/cgi/index.cgi +5 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/fr/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/po/cs/helloerb1.po +66 -0
- data/samples/cgi/po/cs/helloerb2.po +52 -0
- data/samples/cgi/po/cs/hellolib.po +25 -0
- data/samples/cgi/po/cs/main.po +78 -0
- data/samples/cgi/po/fr/main.po +8 -8
- data/samples/cgi/po/ko/helloerb1.po +2 -3
- data/samples/cgi/po/ko/helloerb2.po +1 -2
- data/samples/cgi/po/ko/hellolib.po +1 -2
- data/samples/cgi/po/ko/main.po +2 -3
- data/samples/cgi/po/nl/helloerb1.po +60 -0
- data/samples/cgi/po/nl/helloerb2.po +52 -0
- data/samples/cgi/po/nl/hellolib.po +24 -0
- data/samples/cgi/po/nl/main.po +76 -0
- data/samples/cgi/po/pt_BR/helloerb1.po +59 -0
- data/samples/cgi/po/pt_BR/helloerb2.po +51 -0
- data/samples/cgi/po/pt_BR/hellolib.po +22 -0
- data/samples/cgi/po/pt_BR/main.po +75 -0
- data/samples/locale/cs/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/fr/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/po/cs/hello.po +23 -0
- data/samples/po/cs/hello2.po +31 -0
- data/samples/po/cs/hello_noop.po +27 -0
- data/samples/po/cs/hello_plural.po +26 -0
- data/samples/po/cs/helloglade2.po +37 -0
- data/samples/po/cs/hellogtk.po +23 -0
- data/samples/po/cs/hellotk.po +23 -0
- data/samples/po/fr/helloglade2.po +2 -2
- data/samples/po/hello.pot +1 -0
- data/samples/po/hello2.pot +1 -0
- data/samples/po/hello_noop.pot +2 -1
- data/samples/po/hello_plural.pot +6 -2
- data/samples/po/helloglade2.pot +8 -3
- data/samples/po/hellotk.pot +4 -0
- data/samples/po/ko/hello.po +1 -2
- data/samples/po/ko/hello2.po +1 -2
- data/samples/po/ko/hello_noop.po +1 -2
- data/samples/po/ko/hello_plural.po +1 -2
- data/samples/po/ko/helloglade2.po +2 -2
- data/samples/po/ko/hellogtk.po +1 -2
- data/samples/po/ko/hellotk.po +1 -2
- data/samples/po/nl/hello.po +24 -0
- data/samples/po/nl/hello2.po +32 -0
- data/samples/po/nl/hello_noop.po +28 -0
- data/samples/po/nl/hello_plural.po +26 -0
- data/samples/po/nl/helloglade2.po +31 -0
- data/samples/po/nl/hellogtk.po +24 -0
- data/samples/po/nl/hellotk.po +24 -0
- data/samples/po/pt_BR/hello.po +6 -5
- data/samples/po/pt_BR/hello2.po +6 -5
- data/samples/po/pt_BR/hello_noop.po +6 -5
- data/samples/po/pt_BR/hello_plural.po +6 -6
- data/samples/po/pt_BR/helloglade2.po +6 -5
- data/samples/po/pt_BR/hellogtk.po +6 -5
- data/samples/po/pt_BR/hellotk.po +6 -5
- data/samples/rails/README +21 -15
- data/samples/rails/Rakefile +10 -1
- data/samples/rails/app/controllers/application.rb +10 -18
- data/samples/rails/app/controllers/blog_controller.rb +1 -5
- data/samples/rails/app/helpers/blog_helper.rb +1 -1
- data/samples/rails/app/models/article.rb +15 -0
- data/samples/rails/app/views/blog/_form.rhtml +2 -2
- data/samples/rails/config/boot.rb +17 -0
- data/samples/rails/config/database.yml +6 -4
- data/samples/rails/config/environment.rb +40 -75
- data/samples/rails/config/environments/development.rb +12 -7
- data/samples/rails/config/environments/production.rb +17 -6
- data/samples/rails/config/environments/test.rb +8 -6
- data/samples/rails/locale/cs/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/cs/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/de/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/es/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/fr/LC_MESSAGES/{lang_helper.mo → gettext_plugin.mo} +0 -0
- data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ja/LC_MESSAGES/{lang_helper.mo → gettext_plugin.mo} +0 -0
- data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ko/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/nl/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/nl/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/pt_BR/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/po/blog.pot +57 -37
- data/samples/rails/po/cs/blog.po +116 -0
- data/samples/rails/po/cs/gettext_plugin.po +29 -0
- data/samples/rails/po/de/blog.po +70 -51
- data/samples/rails/po/de/{lang_helper.po → gettext_plugin.po} +4 -5
- data/samples/rails/po/en/blog.po +111 -0
- data/samples/rails/po/es/blog.po +67 -47
- data/samples/rails/po/es/{lang_helper.po → gettext_plugin.po} +5 -5
- data/samples/rails/po/fr/blog.po +65 -45
- data/samples/rails/po/fr/{lang_helper.po → gettext_plugin.po} +4 -4
- data/samples/rails/po/{lang_helper.pot → gettext_plugin.pot} +4 -4
- data/samples/rails/po/ja/blog.po +64 -44
- data/samples/rails/po/ja/{lang_helper.po → gettext_plugin.po} +4 -4
- data/samples/rails/po/ko/blog.po +65 -46
- data/samples/rails/po/ko/{lang_helper.po → gettext_plugin.po} +5 -6
- data/samples/rails/po/nl/blog.po +115 -0
- data/samples/rails/po/nl/gettext_plugin.po +28 -0
- data/samples/rails/po/pt_BR/blog.po +109 -0
- data/samples/rails/po/pt_BR/gettext_plugin.po +27 -0
- data/samples/rails/public/images/rails.png +0 -0
- data/samples/rails/public/index.html +272 -71
- data/samples/rails/public/javascripts/controls.js +441 -166
- data/samples/rails/public/javascripts/dragdrop.js +261 -279
- data/samples/rails/public/javascripts/effects.js +657 -277
- data/samples/rails/public/javascripts/prototype.js +911 -223
- data/samples/rails/public/robots.txt +1 -0
- data/samples/rails/public/stylesheets/scaffold.css +1 -1
- data/samples/rails/script/about +3 -0
- data/samples/rails/script/breakpointer +3 -4
- data/samples/rails/script/console +3 -23
- data/samples/rails/script/destroy +3 -7
- data/samples/rails/script/generate +3 -7
- data/samples/rails/script/performance/benchmarker +3 -0
- data/samples/rails/script/performance/profiler +3 -0
- data/samples/rails/script/plugin +3 -0
- data/samples/rails/script/process/reaper +3 -0
- data/samples/rails/script/process/spawner +3 -0
- data/samples/rails/script/process/spinner +3 -0
- data/samples/rails/script/runner +3 -29
- data/samples/rails/script/server +3 -49
- data/samples/rails/vendor/plugins/gettext/init.rb +19 -0
- data/samples/rails/vendor/{lang_helper.rb → plugins/gettext/lib/gettext_plugin.rb} +15 -11
- data/src/poparser.ry +171 -0
- data/test/gettext_runner.rb +3 -1
- data/test/gettext_test.rb +56 -31
- data/test/gettext_test_cgi.rb +12 -0
- data/test/gettext_test_parser.rb +3 -0
- data/test/gettext_test_string.rb +14 -0
- data/test/locale/cr/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/da/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/da/LC_MESSAGES/plural_error.mo +0 -0
- data/test/locale/fr/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/fr/LC_MESSAGES/plural_error.mo +0 -0
- data/test/locale/ir/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/la/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/li/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/po/LC_MESSAGES/plural.mo +0 -0
- data/test/locale/sl/LC_MESSAGES/plural.mo +0 -0
- data/test/po/cr/plural.po +3 -3
- data/test/po/da/plural.po +2 -2
- data/test/po/da/plural_error.po +2 -1
- data/test/po/fr/plural.po +2 -2
- data/test/po/fr/plural_error.po +2 -1
- data/test/po/ir/plural.po +3 -3
- data/test/po/la/plural.po +3 -3
- data/test/po/li/plural.po +3 -3
- data/test/po/po/plural.po +3 -3
- data/test/po/sl/plural.po +4 -4
- data/test/test.sh +1 -0
- data/test/test_rubyparser.rb +20 -0
- data/test/{test_rubyparser_n.rb → test_rubyparser_N.rb} +0 -0
- metadata +163 -43
- data/README.ja +0 -115
- data/data/locale/de/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rmsgfmt.mo +0 -0
- data/gettext-1.0.0-mswin32.gem +0 -0
- data/po/de/rmsgfmt.po +0 -45
- data/po/es/rmsgfmt.po +0 -43
- data/po/fr/rmsgfmt.po +0 -43
- data/po/it/rmsgfmt.po +0 -44
- data/po/ja/rmsgfmt.po +0 -43
- data/po/ko/rmsgfmt.po +0 -40
- data/po/pt_BR/rmsgfmt.po +0 -42
- data/po/rmsgfmt.pot +0 -40
- data/po/sv/rmsgfmt.po +0 -43
- data/samples/rails/locale/de/LC_MESSAGES/lang_helper.mo +0 -0
- data/samples/rails/locale/es/LC_MESSAGES/lang_helper.mo +0 -0
- data/samples/rails/locale/ko/LC_MESSAGES/lang_helper.mo +0 -0
- data/samples/rails/log/development.log +0 -378
- data/src/rmsgfmt.ry +0 -233
data/bin/rgettext
CHANGED
data/bin/rmsgfmt
CHANGED
data/bin/rmsgmerge
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#! e:/ruby/bin/ruby
|
2
|
+
=begin
|
3
|
+
rmsgmerge - ruby version of msgmerge
|
4
|
+
|
5
|
+
Copyright (C) 2005 Masao Mutoh
|
6
|
+
|
7
|
+
You may redistribute it and/or modify it under the same
|
8
|
+
license terms as Ruby.
|
9
|
+
|
10
|
+
$Id: rmsgmerge,v 1.2 2005/11/27 15:35:54 mutoh Exp $
|
11
|
+
=end
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'gettext/rmsgmerge'
|
15
|
+
rescue LoadError
|
16
|
+
begin
|
17
|
+
require 'rubygems'
|
18
|
+
require_gem 'gettext/rmsgmerge'
|
19
|
+
rescue LoadError
|
20
|
+
raise 'Ruby-GetText-Package are not installed.'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
GetText.rmsgmerge
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,86 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; tab-width: 4 -*-
|
2
|
+
*
|
3
|
+
* Copyright (C) 2002-2005 Masao Mutoh
|
4
|
+
*
|
5
|
+
* You may redistribute it and/or modify it under the same
|
6
|
+
* license terms as Ruby.
|
7
|
+
*
|
8
|
+
* $Id: _locale.c,v 1.2 2005/08/20 17:05:34 mutoh Exp $
|
9
|
+
*/
|
10
|
+
|
11
|
+
#include "ruby.h"
|
12
|
+
|
13
|
+
#if defined HAVE_WINDOWS_H
|
14
|
+
# include <windows.h>
|
15
|
+
#else
|
16
|
+
# if defined HAVE_SETLOCALE
|
17
|
+
# include <locale.h>
|
18
|
+
# endif
|
19
|
+
# if defined HAVE_NL_LANGINFO
|
20
|
+
# include <langinfo.h>
|
21
|
+
# endif
|
22
|
+
#endif
|
23
|
+
#ifndef StringValuePtr
|
24
|
+
#define StringValuePtr(s) STR2CSTR(s)
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#if defined HAVE_WINDOWS_H
|
28
|
+
static VALUE
|
29
|
+
gt_locale_id_win32(self)
|
30
|
+
VALUE self;
|
31
|
+
{
|
32
|
+
int lcid, pri_id, sub_id;
|
33
|
+
lcid = GetUserDefaultLangID();
|
34
|
+
pri_id = lcid & 0x3ff;
|
35
|
+
sub_id = lcid >> 10;
|
36
|
+
return rb_assoc_new(INT2FIX(pri_id), INT2FIX(sub_id));
|
37
|
+
}
|
38
|
+
#endif
|
39
|
+
static VALUE
|
40
|
+
gt_setlocale(self, type, locale)
|
41
|
+
VALUE self, type, locale;
|
42
|
+
{
|
43
|
+
# if defined HAVE_SETLOCALE
|
44
|
+
char* ret = setlocale(NUM2INT(type),
|
45
|
+
NIL_P(locale) ? NULL : StringValuePtr(locale));
|
46
|
+
return ret == NULL ? rb_str_new2("C") : rb_str_new2(ret);
|
47
|
+
# else
|
48
|
+
return rb_str_new2("C");
|
49
|
+
# endif
|
50
|
+
}
|
51
|
+
|
52
|
+
static VALUE
|
53
|
+
gt_codeset(self)
|
54
|
+
VALUE self;
|
55
|
+
{
|
56
|
+
#if defined HAVE_WINDOWS_H
|
57
|
+
char buf[2 + 10 + 1];
|
58
|
+
sprintf (buf, "CP%u", GetACP ());
|
59
|
+
return rb_str_new2(buf);
|
60
|
+
#elif defined HAVE_NL_LANGINFO
|
61
|
+
return rb_str_new2(nl_langinfo(CODESET));
|
62
|
+
#else
|
63
|
+
return rb_str_new2("UTF-8");
|
64
|
+
#endif
|
65
|
+
}
|
66
|
+
|
67
|
+
void Init__locale()
|
68
|
+
{
|
69
|
+
VALUE mLocale = rb_define_module("Locale");
|
70
|
+
|
71
|
+
#if defined HAVE_WINDOWS_H
|
72
|
+
rb_define_module_function(mLocale, "__locale_id", gt_locale_id_win32, 0);
|
73
|
+
#endif
|
74
|
+
rb_define_module_function(mLocale, "set", gt_setlocale, 2);
|
75
|
+
rb_define_module_function(mLocale, "codeset", gt_codeset, 0);
|
76
|
+
# if defined HAVE_SETLOCALE
|
77
|
+
rb_define_const(mLocale, "ALL", INT2NUM(LC_ALL));
|
78
|
+
rb_define_const(mLocale, "COLLATE", INT2NUM(LC_COLLATE));
|
79
|
+
rb_define_const(mLocale, "CTYPE", INT2NUM(LC_CTYPE));
|
80
|
+
rb_define_const(mLocale, "MESSAGES", INT2NUM(LC_MESSAGES));
|
81
|
+
rb_define_const(mLocale, "MONETARY", INT2NUM(LC_MONETARY));
|
82
|
+
rb_define_const(mLocale, "NUMERIC", INT2NUM(LC_NUMERIC));
|
83
|
+
rb_define_const(mLocale, "TIME", INT2NUM(LC_TIME));
|
84
|
+
#endif
|
85
|
+
|
86
|
+
}
|
@@ -73,7 +73,7 @@ void Init__locale()
|
|
73
73
|
#endif
|
74
74
|
rb_define_module_function(mLocale, "set", gt_setlocale, 2);
|
75
75
|
rb_define_module_function(mLocale, "codeset", gt_codeset, 0);
|
76
|
-
#
|
76
|
+
#if defined HAVE_SETLOCALE
|
77
77
|
rb_define_const(mLocale, "ALL", INT2NUM(LC_ALL));
|
78
78
|
rb_define_const(mLocale, "COLLATE", INT2NUM(LC_COLLATE));
|
79
79
|
rb_define_const(mLocale, "CTYPE", INT2NUM(LC_CTYPE));
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,11 +1,11 @@
|
|
1
1
|
have_header: checking for windows.h... -------------------- yes
|
2
2
|
|
3
|
-
"cl -
|
4
|
-
Microsoft(R) 32-bit C/C++ Standard Compiler Version 13.10.3077 for 80x86
|
3
|
+
"cl -IE:/ruby-gettext-package-1.1.0/ext/gettext/gettext -Ie:/ruby/lib/ruby/1.8/i386-mswin32 -I. -I./.. -I./../missing -MD -Zi -O2b2xg- -G6 conftest.c -P"
|
4
|
+
Microsoft (R) 32-bit C/C++ Standard Compiler Version 13.10.3077 for 80x86
|
5
5
|
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
|
6
6
|
|
7
|
-
cl :
|
8
|
-
cl :
|
7
|
+
cl : Command line warning D4029 : optimization is not available in the standard edition compiler
|
8
|
+
cl : Command line warning D4002 : ignoring unknown option '-Og-'
|
9
9
|
conftest.c
|
10
10
|
checked program was:
|
11
11
|
/* begin */
|
Binary file
|
data/lib/_locale.so
CHANGED
Binary file
|
data/lib/gettext.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
You may redistribute it and/or modify it under the same
|
11
11
|
license terms as Ruby.
|
12
12
|
|
13
|
-
$Id: gettext.rb,v 1.
|
13
|
+
$Id: gettext.rb,v 1.5 2005/11/30 17:59:14 mutoh Exp $
|
14
14
|
=end
|
15
15
|
|
16
16
|
require 'rbconfig'
|
@@ -18,6 +18,7 @@ require 'gettext/version'
|
|
18
18
|
require 'gettext/mo'
|
19
19
|
require 'gettext/locale'
|
20
20
|
require 'gettext/textdomain'
|
21
|
+
require 'gettext/string'
|
21
22
|
|
22
23
|
module GetText
|
23
24
|
class NoboundTextDomainError < RuntimeError
|
@@ -27,9 +28,15 @@ module GetText
|
|
27
28
|
@@__textdomain_key = Hash.new
|
28
29
|
|
29
30
|
@@output_charset = nil
|
31
|
+
@@locale = nil
|
30
32
|
|
31
33
|
def bindtextdomain(domainname, path = nil, locale = nil, charset = nil)
|
32
|
-
locale
|
34
|
+
if @@locale
|
35
|
+
locale = @@locale
|
36
|
+
Locale.set(Locale::CTYPE, locale)
|
37
|
+
else
|
38
|
+
locale ||= Locale.get
|
39
|
+
end
|
33
40
|
if @@output_charset
|
34
41
|
charset = @@output_charset
|
35
42
|
else
|
@@ -43,6 +50,7 @@ module GetText
|
|
43
50
|
textdomain = @@__textdomain_key[domainname]
|
44
51
|
@@__textdomain[src] = textdomain
|
45
52
|
end
|
53
|
+
|
46
54
|
if ! textdomain or ! textdomain.same_property?(domainname, path, locale, charset)
|
47
55
|
textdomain = TextDomain.new(domainname, path, locale, charset)
|
48
56
|
@@__textdomain_key[domainname] = textdomain
|
@@ -67,7 +75,7 @@ module GetText
|
|
67
75
|
|
68
76
|
def ngettext(msgid, msgid_plural, n)
|
69
77
|
textdomain = @@__textdomain[callersrc]
|
70
|
-
textdomain ? textdomain.ngettext(msgid, msgid_plural, n) : msgid
|
78
|
+
textdomain ? textdomain.ngettext(msgid, msgid_plural, n) : (n == 1 ? msgid : msgid_plural)
|
71
79
|
end
|
72
80
|
|
73
81
|
def N_(msgid)
|
@@ -94,6 +102,7 @@ module GetText
|
|
94
102
|
end
|
95
103
|
|
96
104
|
def locale=(locale)
|
105
|
+
@@locale = locale
|
97
106
|
textdomain = @@__textdomain[callersrc]
|
98
107
|
textdomain.set_locale(locale) if textdomain
|
99
108
|
locale
|
@@ -107,6 +116,10 @@ module GetText
|
|
107
116
|
@@output_charset
|
108
117
|
end
|
109
118
|
|
119
|
+
def locale
|
120
|
+
@@locale
|
121
|
+
end
|
122
|
+
|
110
123
|
def charset=(cs)
|
111
124
|
textdomain = @@__textdomain[callersrc]
|
112
125
|
textdomain.set_charset(cs) if textdomain
|
@@ -122,6 +135,6 @@ module GetText
|
|
122
135
|
module_function :bindtextdomain, :textdomain,
|
123
136
|
:N_, :gettext, :_, :ngettext, :n_,
|
124
137
|
:sgettext, :s_, :callersrc,
|
125
|
-
:setlocale, :set_locale, :locale=, :charset=,
|
138
|
+
:setlocale, :set_locale, :locale=, :locale, :charset=,
|
126
139
|
:set_output_charset, :output_charset=, :output_charset
|
127
140
|
end
|
data/lib/gettext/cgi.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
You may redistribute it and/or modify it under the same
|
7
7
|
license terms as Ruby.
|
8
8
|
|
9
|
-
$Id: cgi.rb,v 1.
|
9
|
+
$Id: cgi.rb,v 1.4 2005/12/07 17:09:39 mutoh Exp $
|
10
10
|
=end
|
11
11
|
|
12
12
|
require 'cgi'
|
@@ -14,8 +14,10 @@ require 'gettext'
|
|
14
14
|
|
15
15
|
module Locale
|
16
16
|
alias :orig_get :get
|
17
|
+
alias :orig_set :set
|
17
18
|
|
18
19
|
@@cgi = nil
|
20
|
+
@@locale_cgi = nil
|
19
21
|
|
20
22
|
module_function
|
21
23
|
def cgi=(cgi)
|
@@ -27,28 +29,40 @@ module Locale
|
|
27
29
|
@@cgi
|
28
30
|
end
|
29
31
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
32
|
+
def normalize(lang)
|
33
|
+
lang = lang.split(',').first.gsub(/_/, "-").split('-') rescue []
|
34
|
+
language = lang[0]
|
35
|
+
dialect = lang[1]
|
36
|
+
language = language ? language.downcase : 'en' # default is en
|
37
|
+
dialect = dialect ? "_#{dialect.upcase}" : ""
|
38
|
+
ret = "#{language}#{dialect}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def get(lctype = Locale::CTYPE) #lctype doesn't used here.
|
42
|
+
ret = @@locale_cgi
|
43
|
+
unless ret
|
44
|
+
@@cgi = CGI.new unless @@cgi
|
45
|
+
if ret = @@cgi["lang"] and ret.size > 0
|
46
|
+
$stderr.print "query_string: lang = #{ret}\n" if $DEBUG
|
47
|
+
elsif ret = @@cgi.cookies["lang"][0]
|
48
|
+
$stderr.print "cookie: lang = #{ret}\n" if $DEBUG
|
49
|
+
elsif lang = @@cgi.accept_language
|
50
|
+
$stderr.print "accept lanaugage: lang = #{lang}\n" if $DEBUG
|
51
|
+
ret = normalize(lang)
|
52
|
+
else
|
53
|
+
ret = "en"
|
54
|
+
end
|
47
55
|
end
|
48
56
|
$stderr.print "Locale.get = #{ret}\n" if $DEBUG
|
49
57
|
ret
|
50
58
|
end
|
51
59
|
|
60
|
+
def set(lctype, loc)
|
61
|
+
# Override this method. Because the value from WWW browser doesn't
|
62
|
+
# match to the locale strings of POSIX setlocale.
|
63
|
+
@@locale_cgi = loc
|
64
|
+
end
|
65
|
+
|
52
66
|
def codeset
|
53
67
|
@@cgi = CGI.new unless @@cgi
|
54
68
|
codesets = @@cgi.accept_charset
|
@@ -61,9 +75,10 @@ module Locale
|
|
61
75
|
end
|
62
76
|
|
63
77
|
alias :charset :codeset
|
78
|
+
alias :setlocale :set
|
64
79
|
alias :set_cgi :cgi=
|
65
80
|
|
66
|
-
module_function :charset, :set_cgi
|
81
|
+
module_function :charset, :set_cgi, :set, :setlocale
|
67
82
|
end
|
68
83
|
|
69
84
|
module GetText
|
data/lib/gettext/locale.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
You may redistribute it and/or modify it under the same
|
7
7
|
license terms as Ruby.
|
8
8
|
|
9
|
-
$Id: locale.rb,v 1.
|
9
|
+
$Id: locale.rb,v 1.4 2005/09/04 17:47:54 mutoh Exp $
|
10
10
|
=end
|
11
11
|
|
12
12
|
begin
|
@@ -41,18 +41,8 @@ else
|
|
41
41
|
end
|
42
42
|
|
43
43
|
module Locale
|
44
|
-
def get
|
45
|
-
|
46
|
-
return ret if ret
|
47
|
-
|
48
|
-
ret = nil
|
49
|
-
["LC_ALL", "LC_MESSAGES", "LANG"].each do |env|
|
50
|
-
ret = ENV[env]
|
51
|
-
break if ret
|
52
|
-
end
|
53
|
-
|
54
|
-
ret = "C" unless ret
|
55
|
-
ret
|
44
|
+
def get(lctype = Locale::CTYPE)
|
45
|
+
__get(lctype)
|
56
46
|
end
|
57
47
|
|
58
48
|
alias :setlocale :set
|
@@ -6,14 +6,14 @@
|
|
6
6
|
You may redistribute it and/or modify it under the same
|
7
7
|
license terms as Ruby.
|
8
8
|
|
9
|
-
$Id: locale_default.rb,v 1.
|
9
|
+
$Id: locale_default.rb,v 1.3 2005/09/04 17:47:54 mutoh Exp $
|
10
10
|
=end
|
11
11
|
|
12
12
|
module Locale
|
13
13
|
@@locale_initialized = false
|
14
14
|
alias :__set :set
|
15
15
|
def __get(lctype = Locale::CTYPE)
|
16
|
-
# Initialize
|
16
|
+
# Initialize lctype lazily.
|
17
17
|
# This isn't called when 'gettext/cgi' is required.
|
18
18
|
unless @@locale_initialized
|
19
19
|
Locale.set(lctype, "")
|
data/lib/gettext/locale_win32.rb
CHANGED
@@ -6,19 +6,39 @@
|
|
6
6
|
You may redistribute it and/or modify it under the same
|
7
7
|
license terms as Ruby.
|
8
8
|
|
9
|
-
$Id: locale_win32.rb,v 1.
|
9
|
+
$Id: locale_win32.rb,v 1.3 2005/09/04 17:47:54 mutoh Exp $
|
10
10
|
=end
|
11
11
|
|
12
12
|
require 'gettext/locale_table_win32'
|
13
13
|
|
14
14
|
module Locale
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
if
|
19
|
-
|
15
|
+
@@locale_win32 = {}
|
16
|
+
def __get(lctype = Locale::CTYPE)
|
17
|
+
ret = nil
|
18
|
+
if @@locale_win32[lctype]
|
19
|
+
ret = @@locale_win32[lctype]
|
20
|
+
else
|
21
|
+
["LC_ALL", "LC_MESSAGES", "LANG"].each do |env|
|
22
|
+
ret = ENV[env]
|
23
|
+
break if ret
|
24
|
+
end
|
25
|
+
unless ret
|
26
|
+
pri_id, sub_id = __locale_id
|
27
|
+
lang = LocaleTable.assoc(pri_id)
|
28
|
+
if lang.size == 3
|
29
|
+
lang = lang[2].assoc(sub_id)
|
30
|
+
end
|
31
|
+
ret = lang ? lang[1] : "C"
|
32
|
+
end
|
33
|
+
@@locale_win32[lctype] = ret
|
34
|
+
end
|
35
|
+
ret
|
36
|
+
end
|
37
|
+
|
38
|
+
def set(lctype, loc)
|
39
|
+
if lctype == ALL
|
40
|
+
@@locale_win32[lctype] = loc
|
20
41
|
end
|
21
|
-
lang ? lang[1] : nil
|
22
42
|
end
|
23
43
|
|
24
44
|
unless defined? CTYPE
|