cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

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

How to manage multiple languages in an experience

Stefano
7-Bedrock

How to manage multiple languages in an experience

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:

  • A pop-up containing as many buttons as languages that allows the customer to change the language of all the strings inside the experience.
  • All the strings values are determined by as many application parameters. Such app parameters are binded to the "TEXT" property of the label widget.
  • Via JS code, I can determine the app parameters values. For example:

$scope.MY-APP-PARAM = function() {
$scope.app.params.MY-LABEL = "This is a sample text.";
}

  • I noticed that it is possible to load .xlsx or .csv files in VS, so I was thinking about creating a language.xlsx or .csv file, load it and access it in order to determine the strings values depending on the language the customer choose.

 

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.

 

ACCEPTED SOLUTION

Accepted Solutions

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

 

View solution in original post

2 REPLIES 2

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

 

Announcements

Top Tags