[Pkg-ruby-extras-commits] r1183 - in packages-wip: .
libintl-gettext-ruby libintl-gettext-ruby/branches
libintl-gettext-ruby/branches/upstream
libintl-gettext-ruby/branches/upstream/current
Vincent Fourmond
fourmond-guest at alioth.debian.org
Fri Dec 8 23:46:18 CET 2006
Author: fourmond-guest
Date: 2006-12-08 23:46:16 +0100 (Fri, 08 Dec 2006)
New Revision: 1183
Added:
packages-wip/libintl-gettext-ruby/
packages-wip/libintl-gettext-ruby/branches/
packages-wip/libintl-gettext-ruby/branches/upstream/
packages-wip/libintl-gettext-ruby/branches/upstream/current/
packages-wip/libintl-gettext-ruby/branches/upstream/current/extconf.rb
packages-wip/libintl-gettext-ruby/branches/upstream/current/intl.c
packages-wip/libintl-gettext-ruby/tags/
Log:
[svn-inject] Installing original source of libintl-gettext-ruby
Added: packages-wip/libintl-gettext-ruby/branches/upstream/current/extconf.rb
===================================================================
--- packages-wip/libintl-gettext-ruby/branches/upstream/current/extconf.rb 2006-12-06 11:32:49 UTC (rev 1182)
+++ packages-wip/libintl-gettext-ruby/branches/upstream/current/extconf.rb 2006-12-08 22:46:16 UTC (rev 1183)
@@ -0,0 +1,9 @@
+require 'mkmf'
+
+$LDFLAGS = "-L/usr/local/lib";
+$CFLAGS = "-I/usr/local/include";
+have_library( "xpg4", "setlocale" );
+have_header( "locale.h" );
+if ( have_header( "libintl.h" ) and (have_library( "intl", "gettext" ) or have_func( "gettext" )) )
+ create_makefile( "intl" );
+end
Added: packages-wip/libintl-gettext-ruby/branches/upstream/current/intl.c
===================================================================
--- packages-wip/libintl-gettext-ruby/branches/upstream/current/intl.c 2006-12-06 11:32:49 UTC (rev 1182)
+++ packages-wip/libintl-gettext-ruby/branches/upstream/current/intl.c 2006-12-08 22:46:16 UTC (rev 1183)
@@ -0,0 +1,128 @@
+/************************************************
+
+ intl.c
+
+ Copyright (C) 1999 HIRATA Naoto
+
+************************************************/
+#include "ruby.h"
+#include <libintl.h>
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+VALUE gIntl;
+
+static VALUE intl_initialize( self, domain )
+ VALUE self;
+ VALUE domain;
+{
+ char* lang;
+ Check_Type( domain, T_STRING );
+/* setlocale( LC_MESSAGES, "" );*/
+ if ( lang = getenv( "LC_ALL" ) )
+ setlocale( LC_ALL, lang );
+ else if ( lang = getenv( "LANG" ) )
+ setlocale( LC_ALL, lang );
+ else
+ setlocale( LC_ALL, "" );
+ textdomain( STR2CSTR( domain ) );
+
+ return Qnil;
+}
+
+static VALUE intl_bindtextdomain( self, domain, dirname )
+ VALUE self;
+ VALUE domain;
+ VALUE dirname;
+{
+ char* new_dirname;
+
+ Check_Type( domain, T_STRING );
+ switch( TYPE( dirname ) ) {
+ case T_STRING:
+ new_dirname = bindtextdomain( STR2CSTR( domain ), STR2CSTR( dirname ) );
+ break;
+ case T_NIL:
+ new_dirname = bindtextdomain( STR2CSTR( domain ), NULL );
+ break;
+ default:
+ rb_raise( rb_eTypeError, "dirname is Not String or Null" );
+ }
+
+ return rb_str_new2( new_dirname );
+}
+
+static VALUE intl_dcgettext( self, domain, msgid, category )
+ VALUE self;
+ VALUE domain;
+ VALUE msgid;
+ VALUE category;
+{
+ char* msgstr;
+
+ Check_Type( domain, T_STRING );
+ Check_Type( msgid, T_STRING );
+ Check_Type( category, T_FIXNUM );
+ msgstr = dcgettext( STR2CSTR( domain ), STR2CSTR( msgid ), FIX2INT( category ) );
+
+ return rb_str_new2( msgstr );
+}
+
+static VALUE intl_dgettext( self, domain, msgid )
+ VALUE self;
+ VALUE domain;
+ VALUE msgid;
+{
+ char* msgstr;
+
+ Check_Type( domain, T_STRING );
+ Check_Type( msgid, T_STRING );
+ msgstr = dgettext( STR2CSTR( domain ), STR2CSTR( msgid ) );
+
+ return rb_str_new2( msgstr );
+}
+
+static VALUE intl_gettext( self, msgid )
+ VALUE self;
+ VALUE msgid;
+{
+ char* msgstr;
+
+ Check_Type( msgid, T_STRING );
+ msgstr = gettext( STR2CSTR( msgid ) );
+
+ return rb_str_new2( msgstr );
+}
+
+static VALUE intl_textdomain( self, domain )
+ VALUE self;
+ VALUE domain;
+{
+ char* new_domain;
+
+ Check_Type( domain, T_STRING );
+ new_domain = textdomain( STR2CSTR( domain ) );
+
+ return rb_str_new2( new_domain );
+}
+
+void Init_intl()
+{
+ gIntl = rb_define_class( "Intl", rb_cObject );
+ rb_define_method( gIntl, "initialize", intl_initialize, 1 );
+ rb_define_method( gIntl, "gettext", intl_gettext, 1 );
+ rb_define_method( gIntl, "_", intl_gettext, 1 );
+ rb_define_method( gIntl, "bindtextdomain", intl_bindtextdomain, 2 );
+ rb_define_method( gIntl, "dcgettext", intl_dcgettext, 3 );
+ rb_define_method( gIntl, "dgettext", intl_dgettext, 2 );
+ rb_define_method( gIntl, "textdomain", intl_textdomain, 1 );
+
+ rb_define_const( gIntl, "LC_ALL", INT2FIX( LC_ALL ) );
+ rb_define_const( gIntl, "LC_COLLATE", INT2FIX( LC_COLLATE ) );
+ rb_define_const( gIntl, "LC_CTYPE", INT2FIX( LC_CTYPE ) );
+ rb_define_const( gIntl, "LC_MESSAGES", INT2FIX( LC_MESSAGES ) );
+ rb_define_const( gIntl, "LC_MONETARY", INT2FIX( LC_MONETARY ) );
+ rb_define_const( gIntl, "LC_NUMERIC", INT2FIX( LC_NUMERIC ) );
+ rb_define_const( gIntl, "LC_TIME", INT2FIX( LC_TIME ) );
+}
More information about the Pkg-ruby-extras-commits
mailing list