diff --git a/src/main/java/org/commcare/core/process/CommCareInstanceInitializer.java b/src/main/java/org/commcare/core/process/CommCareInstanceInitializer.java index c81004673..467708c97 100644 --- a/src/main/java/org/commcare/core/process/CommCareInstanceInitializer.java +++ b/src/main/java/org/commcare/core/process/CommCareInstanceInitializer.java @@ -244,7 +244,7 @@ protected InstanceRoot setupSessionData(ExternalDataInstance instance) { TreeElement root = SessionInstanceBuilder.getSessionInstance(sessionWrapper.getFrame(), getDeviceId(), getVersionString(), getCurrentDrift(), u.getUsername(), u.getUniqueId(), - u.getProperties(), getWindowWidth()); + u.getProperties(), getWindowWidth(), getLocale()); root.setParent(instance.getBase()); return new ConcreteInstanceRoot(root); } @@ -253,6 +253,10 @@ protected String getWindowWidth() { return sessionWrapper.getWindowWidth(); } + protected String getLocale() { + return Localization.getCurrentLocale(); + } + protected long getCurrentDrift() { return 0; } diff --git a/src/main/java/org/commcare/session/SessionInstanceBuilder.java b/src/main/java/org/commcare/session/SessionInstanceBuilder.java index 060677d9b..a638f8811 100644 --- a/src/main/java/org/commcare/session/SessionInstanceBuilder.java +++ b/src/main/java/org/commcare/session/SessionInstanceBuilder.java @@ -17,11 +17,12 @@ public class SessionInstanceBuilder { public static TreeElement getSessionInstance(SessionFrame frame, String deviceId, String appversion, long drift, String username, String userId, - Hashtable userFields, String windowWidth) { + Hashtable userFields, String windowWidth, + String applanguage) { TreeElement sessionRoot = new TreeElement("session", 0); addSessionNavData(sessionRoot, frame); - addMetadata(sessionRoot, deviceId, appversion, username, userId, drift, windowWidth); + addMetadata(sessionRoot, deviceId, appversion, username, userId, drift, windowWidth, applanguage); addUserProperties(sessionRoot, userFields); return sessionRoot; @@ -88,7 +89,8 @@ private static String getCalloutSearchResultCount(StackFrameStep step) { private static void addMetadata(TreeElement sessionRoot, String deviceId, String appversion, String username, - String userId, long drift, String windowWidth) { + String userId, long drift, String windowWidth, + String applanguage) { TreeElement sessionMeta = new TreeElement("context", 0); addData(sessionMeta, "deviceid", deviceId); @@ -97,6 +99,7 @@ private static void addMetadata(TreeElement sessionRoot, String deviceId, addData(sessionMeta, "userid", userId); addData(sessionMeta, "drift", String.valueOf(drift)); addData(sessionMeta, "window_width", windowWidth); + addData(sessionMeta, "applanguage", applanguage); sessionRoot.addChild(sessionMeta); }