Localized strings in services

Hi,

Is there a way to use localized strings in Appfarm services? E.g. ENUM names in a specified language. We send active language from the app to the service for some other language-aware objects, but I’m not sure how to get it to work with ENUMS.

Hi Joanna, and thanks for the question!

There is an ongoing initiative to be able to change the Active Language within Services (from this request) which has a current estimate of availability after the summer.

In the meantime, could a possible setup be to translate the Enum values in the app using inbuilt language handling, and then to pass the translated value(s) to the service as a string, for instance?

Rhys

Hi Rhys,

Great, please keep us posted when this gets released.

In our case, I think we’ll wait until a sustainable solutions is available. We have multiple enums the service needs, and passing each value in every supported language as a string for every enum option would quickly become difficult to manage.

Just to make sure I understand correctly: there is currently no way to access the translated names and descriptions of an enum within a service, even when passing language as a param?

Understood - the thought behind my suggestion was to translate the Enum(s) on the app side and then send the translated value as a single parameter to the service, for instance Translated Enum 1. Then only one parameter will be needed to the service, and it is more manageable than many different Enums for many different languages. But the best solution is naturally the ability to change language and access them directly on the Enum itself.

With regards to your question, this is correct - there is currently no inbuilt way to access translated Enum properties from within a service.

Another possible solution is to have a Translation object class which can be used to cross-reference translated values from the context of a Service, or having a Javascript function that includes hard-coded translation values. But these are of course not ideal, given that the translations list would then need to be implemented and maintained in several places at the same time.

This thread will be updated when language-handling becomes available in Services.

Rhys