I have an app that displays some fields according to the selected language. There are two languages, French and English. When the user change language, I need to update the display according to the new set language. The values to update are fields in a table.
For example in a table I have:
Content_fr Content in French, Text field
Content_en Content in English, Text field
Content Content, calculation that returns a text
The calculated field is set to
if ( $$Language = "Fr" ; Content_fr; Content_en )
and not saved. The selected language is saved in a global variable.
When the user changes the language, Content field value is not changed. I came to the conclusion that the change in the value of a global variable does not trigger the recalculation of the calculated field. Am I right ? If so that means I would need to have the language saved in a field of the same table, for example a global field. Since I don't want to give users permission to write to tables. would that be an issue ? Are there other way to achieve my goal ? This app runs on an iPad.
I want to change the buttons' labels (they come from a list in a global variable, and the list itself is created by a script that runs ExecuteSQL to pick contents from a nonsaved calculated field)
And I want to change the text to the new language, again that comes form a non calculated field
Well, I said the calculated fields were unstored, but the ckeckbox was not checked. Now it works, event if I don't do a Refresh Window. All I need to do is Resfresh Object, that is the Button bar and the field.
Dumb me !
EDIT on Feb 24th 2023
I can't set this message as the solution/answer because I am the creator of this thread.
How did you come to this solution in the first place? Calculations on every layout might be challenging?!
I have a table for interface texts
Number - used for identifying a repetition later on loading text
LanguageID - every text in every language has one entry in the table
Text
Type - e.g. button, label, message, value for picklist
Depending on the application it might hold thousands of entries.
Next I generated one global stored text field in the applications session table named sTxt with 3000 repetitions.
The repetitions are filled once while starting the session and can be reset if the user wants to change the language. This happens via script in a loop iterating through the table selecting the needed text by number and language match.
These are referenced everywhere in the application.
This solution works on a single layout. There are many subjects though. With 2 button bars I select a Topic and a Subject, that results in a text to be displayed. This text as well as the buttons on the Subjects button bar ahev to be displayed in two languages, either English or French.
Finally had time to look at this. Looks quite nice. Doesn't pollute variable space (data viewer) as much as having global variables for each translated label. Although slightly more work to remember which is the correct repetition when setting a label for some element.