1

If I want to translate the role to other language, how do I do it?

I can change that to other language as the default but I would like to use English so I don't have to deal with UTF8 issue in my code with Asian charactors.

if(in_array("administer nodes", $user->roles))

I have tried to find it from translation module but this seems not translatable as other text in Drupal.

Hao
  • 6,291
  • 9
  • 39
  • 88

1 Answers1

0

So I'm assuming you've already tried using the t() or st() functions?

If that's so, you may need to try a client-side AJAX translation solution. One way you might do this is to create a vocabulary of terms (corresponding to the English role names), and have the Asian character translation as a secondary field. Then use views to create a view of this vocabulary, and create a lightweight module that: 1) loads a Drupal AJAX script on every page (or every page where role names might be utilized) 2) the script looks for a list of specified containers by id that you know will contain role names 3) searches the view you created for the English pattern, and replaces it in the container with any positive matches

Drupal API's example AJAX module

You could then expand the module/AJAX script to solve other similar translate fails on your site.

mausolos
  • 46
  • 3