Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi all,
I'm trying to find a way to manage multiple languages inside my experiences. I've been searching for a topic in the community from which get any ideas but I found nothing.
This is the solution I'm considering right now:
$scope.MY-APP-PARAM = function() {
$scope.app.params.MY-LABEL = "This is a sample text.";
}
Here comes my problem: my javascript is very poor and I'm not able to load the .xlsx or .csv file in my js script and I don't know how to access it.
Can anyone help me with the JS code or any idea to solve the problem?
Regards,
Stefano.
Solved! Go to Solution.
Hi @dsgnrClarK,
thanks for your reply.
Your suggestion of using a JSON instead of an xlsx is really effective.
I created my dictionary in a json document:
var json = {
"dictionary": [ ...
]
}
and load it in the Vuforia resources.
In my script I access the JSON document to set the value (or the resource) of my application parameters:
$scope.set_language = function() {
$scope.app.params.mode = json.dictionary[lang].mode; //set string value
$scope.app.params.status = json.dictionary[lang].status; //set string value
$scope.app.params.info_mandrino = 'app/resources/Uploaded/info_b_' + lang + '.png'; //set resource value
...
}
The lang variable determines which string (or resource) is picked from the JSON (or the Vuforia resources) and its value is set from the experience user from a proper function:
$scope.language_it = function() {
lang = 0; // ITALIAN
$scope.set_language();
}
$scope.language_en = function() {
lang = 1; // ENGLISH
$scope.set_language();
}
Best regards,
Stefano
Hi, @Stefano
This would not be an easy task.
And other than using .xlsx or .csv, JSON would be a better choice.
You may get some idea from this series of tutorial: https://support.ptc.com/help/vuforia/studio/en/#page/Studio_Help_Center%2Fmetadata%2FMetadata_201_userpick_event.html%23
This would be another approach: https://community.ptc.com/t5/Vuforia-Studio/Internationalization-and-localization/m-p/624937#M6599
Hi @dsgnrClarK,
thanks for your reply.
Your suggestion of using a JSON instead of an xlsx is really effective.
I created my dictionary in a json document:
var json = {
"dictionary": [ ...
]
}
and load it in the Vuforia resources.
In my script I access the JSON document to set the value (or the resource) of my application parameters:
$scope.set_language = function() {
$scope.app.params.mode = json.dictionary[lang].mode; //set string value
$scope.app.params.status = json.dictionary[lang].status; //set string value
$scope.app.params.info_mandrino = 'app/resources/Uploaded/info_b_' + lang + '.png'; //set resource value
...
}
The lang variable determines which string (or resource) is picked from the JSON (or the Vuforia resources) and its value is set from the experience user from a proper function:
$scope.language_it = function() {
lang = 0; // ITALIAN
$scope.set_language();
}
$scope.language_en = function() {
lang = 1; // ENGLISH
$scope.set_language();
}
Best regards,
Stefano