function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mike SlivkaMike Slivka 

Multi-Lingual support and troubleshooting

Hello, I have recently been working with a new Brazilian employee that was having difficulty entereing a opportunity (language was set as Portugese). After doing some research it seems that the user was causing an error in a trigger we have on insert and update for Opportunities (see below)

List<string> AdminProfileNames = 'System Administrator'.split(',');
List<Profile>Admin_Profiles = [Select Id, Name from Profile where Profile.name in :AdminProfileNames];
system.debug('Admin_Profiles[0].id='+Admin_Profiles[0].id);

System.ListException: List index out of bounds: 0

After looking into the code I changed it to the code below and it worked fine for this user.

 List<string> AdminProfileNames = 'System Administrator,Administrador do sistema'.split(',');
List<Profile>Admin_Profiles = [Select Id, Name from Profile where Profile.name in :AdminProfileNames];
system.debug('Admin_Profiles[0].id='+Admin_Profiles[0].id);

This brings up a larger question for me. Through all of my years of programming I have been told that matching things on straight text is dangerous and to use IDs whenver possible. In Salesforce, however, this seems to be used in criteria for searches, rules, exceptions, etc.and is almost the preffered way of doign things. So as our company moves more into international markets I have been told that Translation Workbench is the way to go for multi-Lingual support. I don't know much about this product, but I wanted to see if this will solve all our problems in all the areas of concern (inside APEX triggers, criteria for rules, etc.) or if there are any large problems that still have not been solved with this option.  
kibitzerkibitzer
I don't know that I'd go so far as to say it will solve "all" your problems, but it will definitely help. The main trick in code and Visual Force pages is to use custom labels - they are easy to localize with the translation workbench.
Remember that localization isn't just about language. It also impacts date/time formats and currencies.