Hello Amin,
Before enter in the Array question, can I ask if you already try the Languages sample app? Certainly, in order to translate apps, probably one of the best possible ways is to use the LoadVariables and/or the ParseVariables action. Please, take a look at the Languages sample, made your own test. That sample uses LoadVariables, but, is perfectly possible to use an HTTP Client and the ParseVariables with their response. We can directly set languages/variables for the controls, and, also, these actions support Arrays too.
Hello Amin,
Certainlty, there is no way to use an action like you wanted above. :-( On the other hand, "LoadVariables" and "ParseVariables" support Arrays. So we can define an Array variable inside an INI file like, and then use it with LoadVariables or ParseVariables. Something that may you also can consider is to use Javascript. As you already know, we can use Javascript code anytime, for example, to set certain Array variable: that variable is then accesible from both Javascript and AB code. Please, go ahead if you have any further question, Amin.
Hello Amin,
Remember that we can place in the INI like files not only "entire variables", but, also control's variables, so we can perfectly define variables in this way:
When you load and parse that file (depending if you use LoadVariables or ParseVariables), and once loaded or parsed, we get the variable, the Array, but also the "MyButton1" text, placehoder, etc.
And yes; it's possible to place comments in that files, Amin: just start the commented line by a semicolon, for example:
Probably can be a good idea to divide the files at least in app's views, so, we can look for the appropriate "translate view file" automagically using some variable like "[App.CurrentView]". Anyway, as here if you have any further question, Amin.
Hello Amin,
We can control that. We can control if the current app's view has been already translated, so, we no need to do it again. We can use variables like "flag" to do that. We can control, for example, if the app's view no need to be translated... because the app's language is already the default one, for example.
Place all the strings in one sole file can be attractive... depend on the app, may this can be enough. However, the ability to divide the strings in various files appear to be more easy later, to deal with every specific file/view. On the other hand, probably we are talking about more stuff...
My idea (and I already try it in one specific app) is to prepare a "languages" directory, which is included enterely from the app's Files Manager (we can refer to entire directories, instead to specify files one by one). Then that "languages" directories can have subdirectories.
The first level can be a subdirectory per app's view. Or may we want to have a "views" as the first subdirectory of "languages", and, inside "views", place more subdirectories: one per app's view. Then every app's view directory can have the INI like files that we need, and maybe other stuff, like possible images (that need to be translated too, etc.).
Maybe the "languages" directory, and the "es", "en", subdirectories, then the "views" subdirectory, then the "main", "options", app's views directories, etc., may appear difficult or complex... but in fact we can follow certain rules in order to maintain all of these stuff controlled.
Anyway, as always, depend on the app... maybe one sole file (like you are thinking) can be perfectly enough.
In fact the "Languages" app sample is very simple... may I have a bit of free time in order to prepare another "Languages2" app sample, which try to put in the practice all that I try to explain above.
Hello Amin,
I am right now working in certain app, and, this forum's thread come to my mind. Certainly, we are talking here about Arrays, and the ability to load and parse variables. But we can't forget the ability to deal with JSON. Deal with JSON can be very useful. Supose the below JSON code inside a "config.json" file:
We can load that file with an HttpClient control, and, in their Success event, do something like the below:
After we that, we can access the JSON variables, directly, in this way:
In fact, the usage of the "CopyVar" action is only for our convenience, that is, it's also perfectly possible refer to the above variable, directly, using the HttpClient control's response:
As you can see, we no need (even when it's possible) to use actions like "ObjectGetProp" here, but we can directly use the JSON object's properties/variables. I hope this can be also useful for you and others too, Amin. :-)
Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.
Este sitio utiliza "cookies" útiles para almacenar sus preferencias.