Changeset 377


Ignore:
Timestamp:
Nov 3, 2012, 2:59:08 PM (11 years ago)
Author:
djay
Message:

Add the ZOOTranslate method to the JavaScript? API for supporting multiple languages support from JavaScript? services.

Location:
trunk/zoo-project
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-api/js/ZOO-api.js

    r342 r377  
    414414  }
    415415  return destination;
     416};
     417
     418ZOO._=function(str){
     419    return ZOOTranslate(str);
    416420};
    417421
  • trunk/zoo-project/zoo-kernel/service_internal_js.c

    r368 r377  
    128128  if (!JS_DefineFunction(cx, global, "ZOORequest", JSRequest, 4, 0))
    129129    return 1;
     130  if (!JS_DefineFunction(cx, global, "ZOOTranslate", JSTranslate, 4, 0))
     131    return 1;
    130132  if (!JS_DefineFunction(cx, global, "ZOOUpdateStatus", JSUpdateStatus, 2, 0))
    131133    return 1;
     
    702704  }
    703705  return handle;
     706}
     707
     708JSBool
     709JSTranslate(JSContext *cx, uintN argc, jsval *argv1)
     710{
     711  jsval *argv = JS_ARGV(cx,argv1);
     712  char *str=JSValToChar(cx,&argv[0]);
     713  char *tmpValue=_ss(str);
     714  JS_SET_RVAL(cx, argv1,STRING_TO_JSVAL(JS_NewStringCopyN(cx,tmpValue,strlen(tmpValue)))); 
     715  JS_MaybeGC(cx);
     716  return JS_TRUE;
    704717}
    705718
  • trunk/zoo-project/zoo-kernel/service_internal_js.h

    r368 r377  
    4444  maps* mapsFromJSObject(JSContext *,jsval);
    4545  map* mapFromJSObject(JSContext *,jsval);
     46  JSBool JSTranslate(JSContext*, uintN, jsval*);
    4647  JSBool JSRequest(JSContext*, uintN, jsval*);
    4748
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png