[sword-svn] r3630 - in trunk/bindings: cordova/org.crosswire.sword.cordova.SWORD/www java-jni/jni
scribe at crosswire.org
scribe at crosswire.org
Mon May 20 15:57:19 MST 2019
Author: scribe
Date: 2019-05-20 15:57:18 -0700 (Mon, 20 May 2019)
New Revision: 3630
Modified:
trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js
trunk/bindings/java-jni/jni/swordstub.cpp
Log:
Support overloaded translate(text, successCallback)
Modified: trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js
===================================================================
--- trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js 2019-05-20 04:03:25 UTC (rev 3629)
+++ trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js 2019-05-20 22:57:18 UTC (rev 3630)
@@ -360,6 +360,8 @@
}
SWMgr.prototype.translate = function(text, locale, callback) {
+ // support overloaded (text, callback)
+ if (!callback && locale) { callback = locale; locale = null; }
exec(callback?callback:function() {},
function(err) { utils.alert('[ERROR] problem: ' + err); },
"SWORD", "SWMgr_translate", [text, locale]
Modified: trunk/bindings/java-jni/jni/swordstub.cpp
===================================================================
--- trunk/bindings/java-jni/jni/swordstub.cpp 2019-05-20 04:03:25 UTC (rev 3629)
+++ trunk/bindings/java-jni/jni/swordstub.cpp 2019-05-20 22:57:18 UTC (rev 3630)
@@ -1007,7 +1007,7 @@
const char *text = env->GetStringUTFChars(textJS, NULL);
const char *localeName = env->GetStringUTFChars(localeNameJS, NULL);
- SWBuf translation = assureValidUTF8(LocaleMgr::getSystemLocaleMgr()->translate(text, localeName));
+ SWBuf translation = assureValidUTF8(LocaleMgr::getSystemLocaleMgr()->translate(text, (localeName && strcmp(localeName, "null"))?localeName:0));
env->ReleaseStringUTFChars(localeNameJS, localeName);
env->ReleaseStringUTFChars(textJS, text);
More information about the sword-cvs
mailing list