[SOLVED] Dynamic Multi-lingual
Posted: Tue Aug 29, 2017 1:23 am
Multilingual variables get burned into a compiled program.
I have a use case where a set of menu's is loaded dynamically from a file.
The file will have menu option and a description, but I want the description to be multilingual value.
So I want to put the name of the multilingual variable into the file and use it at runtime.
So I would have
#label.caption := multilingual_value_of(#field from file)
Currently I need to add a case statement for each new menu option to extract the appropriate multilingual variable which is a not elegant.
Concurrently, this same capability would be interesting to use against repository fields.
e.g.
#lbl_Logged_Date_Time := #itlogd.FieldAttributeAsString( Description ) if the field itself (#ITLOGD in this example) were also set able at runtime dynamically, but I don't think that would be a as common a use case. Due to layout issues for responsive design, I had to use labels vs. the default labels for fields in some cases, and this was a way to use the repository values instead of hard coding them and preserving the inbuilt multi-lingual capabilities of the repository.
The difference here is I don't know ahead of time which menu item or multilingual variable will be read from the file.
Is this possible?
Edit:
I thought of this.
The file will contain the name of a field in the repository.
The repository field will contain the multilingual descriptions needed.
At runtime we create a new field object like so
Set_Ref Com(#Result) To(*CREATE_FROM #The_Field.Value.Trim)
Then we set the properties to suppress the input field and only show the description of the field.
This will work (I think), but a bit of a kludge. Hoping for something more elegant. I really want to use the power of multi-lingual variables here, but in a dynamic way.
I have a use case where a set of menu's is loaded dynamically from a file.
The file will have menu option and a description, but I want the description to be multilingual value.
So I want to put the name of the multilingual variable into the file and use it at runtime.
So I would have
#label.caption := multilingual_value_of(#field from file)
Currently I need to add a case statement for each new menu option to extract the appropriate multilingual variable which is a not elegant.
Concurrently, this same capability would be interesting to use against repository fields.
e.g.
#lbl_Logged_Date_Time := #itlogd.FieldAttributeAsString( Description ) if the field itself (#ITLOGD in this example) were also set able at runtime dynamically, but I don't think that would be a as common a use case. Due to layout issues for responsive design, I had to use labels vs. the default labels for fields in some cases, and this was a way to use the repository values instead of hard coding them and preserving the inbuilt multi-lingual capabilities of the repository.
The difference here is I don't know ahead of time which menu item or multilingual variable will be read from the file.
Is this possible?
Edit:
I thought of this.
The file will contain the name of a field in the repository.
The repository field will contain the multilingual descriptions needed.
At runtime we create a new field object like so
Set_Ref Com(#Result) To(*CREATE_FROM #The_Field.Value.Trim)
Then we set the properties to suppress the input field and only show the description of the field.
This will work (I think), but a bit of a kludge. Hoping for something more elegant. I really want to use the power of multi-lingual variables here, but in a dynamic way.