com.caucho.quercus.lib.gettext
Class GettextModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.gettext.GettextModule
All Implemented Interfaces:
QuercusModule

public class GettextModule
extends AbstractQuercusModule

Module to find translated strings and return them in desired charset. Translations are LRU cached.


Field Summary
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
GettextModule()
           
 
Method Summary
 StringValue _(Env env, StringValue message, Value[] args)
          Alias of gettext().
 java.lang.String bind_textdomain_codeset(Env env, java.lang.String domainName, java.lang.String charset)
          Sets charset of translated strings that are returned from this domain.
 Value bindtextdomain(Env env, java.lang.String domainName, StringValue directory)
          Changes root directory of domain.
 StringValue dcgettext(Env env, java.lang.String domainName, StringValue message, int category, Value[] args)
          Same as gettext, but allows overriding of domain and category.
 StringValue dcngettext(Env env, java.lang.String domainName, StringValue msgid1, StringValue msgid2, int n, int category, Value[] args)
          Same as ngettext, but allows overriding of domain and category.
 StringValue dgettext(Env env, java.lang.String domainName, StringValue message, Value[] args)
          Same as gettext, but allows overriding of current domain.
 StringValue dngettext(Env env, java.lang.String domainName, StringValue msgid1, StringValue msgid2, int n, Value[] args)
          Same as ngettext, but allows overriding of current domain.
 java.lang.String[] getLoadedExtensions()
          Returns the extensions loaded by the module.
 StringValue gettext(Env env, StringValue message, Value[] args)
          Returns translated string from current domain and default category.
 StringValue ngettext(Env env, StringValue msgid1, StringValue msgid2, int n, Value[] args)
          Returns translated plural string form from current domain and default category.
 java.lang.String textdomain(Env env, Value domain)
          Changes the current domain.
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getConstMap, getIniDefinitions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GettextModule

public GettextModule()
Method Detail

getLoadedExtensions

public java.lang.String[] getLoadedExtensions()
Description copied from class: AbstractQuercusModule
Returns the extensions loaded by the module.

Specified by:
getLoadedExtensions in interface QuercusModule
Overrides:
getLoadedExtensions in class AbstractQuercusModule

bind_textdomain_codeset

public java.lang.String bind_textdomain_codeset(Env env,
                                                java.lang.String domainName,
                                                java.lang.String charset)
Sets charset of translated strings that are returned from this domain.

Parameters:
env -
domain -
codeset -
Returns:
codeset

bindtextdomain

public Value bindtextdomain(Env env,
                            java.lang.String domainName,
                            StringValue directory)
Changes root directory of domain.

Parameters:
env -
domain -
directory -
Returns:
directory

dcgettext

public StringValue dcgettext(Env env,
                             java.lang.String domainName,
                             StringValue message,
                             int category,
                             Value[] args)
Same as gettext, but allows overriding of domain and category.

Parameters:
env -
domain -
message -
category -

dcngettext

public StringValue dcngettext(Env env,
                              java.lang.String domainName,
                              StringValue msgid1,
                              StringValue msgid2,
                              int n,
                              int category,
                              Value[] args)
Same as ngettext, but allows overriding of domain and category.

Parameters:
env -
domain -
msgid1 -
msgid2 -
n -
category -

dgettext

public StringValue dgettext(Env env,
                            java.lang.String domainName,
                            StringValue message,
                            Value[] args)
Same as gettext, but allows overriding of current domain.

Parameters:
env -
domain -
message -

dngettext

public StringValue dngettext(Env env,
                             java.lang.String domainName,
                             StringValue msgid1,
                             StringValue msgid2,
                             int n,
                             Value[] args)
Same as ngettext, but allows overriding of current domain.

Parameters:
env -
domain -
msgid1 -
msgid2 -
n -

_

public StringValue _(Env env,
                     StringValue message,
                     Value[] args)
Alias of gettext().

Parameters:
env -
message -

gettext

public StringValue gettext(Env env,
                           StringValue message,
                           Value[] args)
Returns translated string from current domain and default category.

Parameters:
env -
message -

ngettext

public StringValue ngettext(Env env,
                            StringValue msgid1,
                            StringValue msgid2,
                            int n,
                            Value[] args)
Returns translated plural string form from current domain and default category.

Parameters:
env -
msgid1 -
msgid2 -
n -
Returns:
translated string, or original plural string if n == 1, else return original singular string

textdomain

public java.lang.String textdomain(Env env,
                                   Value domain)
Changes the current domain.

Parameters:
env -
domain -
Returns:
name of current domain after change.