Write a GreaseMonkey script that reacts to domain strings (for I18N, e.g. cn,en,fr,etc.)

Posted by Shizhidi on Stack Overflow See other posts from Stack Overflow or by Shizhidi
Published on 2010-04-24T15:32:18Z Indexed on 2010/04/24 15:43 UTC
Read the original article Hit count: 268

Hello. Suppose there is a website that supports multiple languages:

  • cn.mydomain.com or mydomain.com/cn or mydomain.cn
  • en.mydomain.com or mydomain.com/en or mydomain.com
  • fr.mydomain.com or mydomain.com/fr or mydomain.fr

I want to write a GreaseMonkey script that has variables assigned different strings/values according to the address the user is loading the page from. How do you do that? Thanks

EDIT: I realize I can just use JavaScript to get the address. Does GreaseMonkey itself support this kind of function?

© Stack Overflow or respective owner

Related posts about greasemonkey

Related posts about internationalization