Feature request - Add a function / API to return what language is currently selected

odk-javarosa
odk-collect
odk-xforms

(Joseph E. Flack IV) #1

What is the general goal of the feature?

Current behavior
There doesn't seem to be a way to programmatically declare in an XForm / XLSForm an ODK Collect client-specific function to determine the language that is currently selected in the client.

Desired behavior
A way to programmatically declare in an XForm / XLSForm an ODK Collect client-specific function to determine the language that is currently selected in the client, e.g.

if(client-language() = 'English', 'hello!', if(client-language() = 'Spanish', 'hola!', ''), '')

What are some example use cases for this feature?

Right now it would be useful as a hack around the inability to use jr:choice-name() on external csv's (including external_choices). So perhaps it would be better simply to implement that change instead. There is an open issue: https://github.com/opendatakit/collect/issues/179

Otherwise, I'm not sure. I feel like I've wanted this in the past, but I don't remember any other specific example.

What can you contribute to making this feature a reality?

With perhaps some guidance, I may be able to contribute to the JavaRosa source code, but my understanding on how this would be implemented is minimal. I was mostly thinking that something like this would be ignored by JavaRosa, and handled by specific clients.