Branch: Tag:

2000-07-21

2000-07-21 05:00:11 by Andreas Lange <andreas@lange.cx>

Now supports ints as keys, faster and takes less memory

Rev: server/etc/modules/RoxenLocale.pmod/module.pmod:1.14
Rev: server/modules/tags/translation_mod.pike:1.6

11:   constant module_name = "Translation module";   constant module_doc = "This module provides an RXML API to the Pike localization system.";   constant thread_safe = 1; - constant cvs_version = "$Id: translation_mod.pike,v 1.5 2000/07/17 16:55:47 lange Exp $"; + constant cvs_version = "$Id: translation_mod.pike,v 1.6 2000/07/21 05:00:11 lange Exp $";         
23:    constant name = "trans-reg";    constant flags = RXML.FLAG_EMPTY_ELEMENT;    -  mapping(string:RXML.Type) req_arg_types = ([ "project":RXML.t_text(RXML.PEnt), -  "path":RXML.t_text(RXML.PEnt) ]); +  mapping(string:RXML.Type) req_arg_types = +  ([ "project" : RXML.t_text(RXML.PEnt) ]);    -  +  mapping(string:RXML.Type) opt_arg_types = +  ([ "path" : RXML.t_text(RXML.PEnt) ]); +     class Frame {    inherit RXML.Frame;   
37:    RoxenLocale.register_project(args->project, args->path);   #endif    } -  id->misc->translation_proj=args->project; +  id->misc->translation_proj = args->project;    result = "";    return 0;    }
48:    inherit RXML.Tag;    constant name = "translate";    -  mapping(string:RXML.Type) req_arg_types = ([ "id":RXML.t_text(RXML.PEnt) ]); -  mapping(string:RXML.Type) opt_arg_types = ([ "project":RXML.t_text(RXML.PEnt), +  mapping(string:RXML.Type) opt_arg_types = ([ +  "id":RXML.t_text(RXML.PEnt), +  "project":RXML.t_text(RXML.PEnt),    "variable":RXML.t_text(RXML.PEnt),    "scope":RXML.t_text(RXML.PEnt) ]);       class Frame {    inherit RXML.Frame;    -  array do_return(RequestID id) { +  array do_return( RequestID id ) {    string proj = args->project || id->misc->translation_proj;   #if constant(Locale.translate)    string trans = Locale.translate(proj, roxen.locale->get(), -  args->id, +  (int)args->id || args->id,    content);   #else    string trans = RoxenLocale.translate(proj, roxen.locale->get(), -  args->id, +  (int)args->id || args->id,    content);   #endif