home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / komunikace / kmeleon / K-Meleon1.1.3en-US.exe / macros / lang.kmm < prev    next >
Text File  |  2007-05-07  |  2KB  |  48 lines

  1. # K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
  2.  
  3. # ---------- Language Selection ------------------------------------------------------------------------------------
  4. #
  5. # Dependencies    : -
  6. # Resources    : -
  7. # Preferences    : -
  8. #
  9. # ------------------------------------------------------------------------------------------------------------------
  10.  
  11. $Lang_Codes="en-US;";
  12. $Lang_Names="&English/International;";
  13.  
  14. Lang_SetLanguage{
  15. menuchecked=($KM_Locale==$ARG);
  16. $_Lang_SetLanguage=$ARG; &_Lang_SetLanguage;
  17. }
  18.  
  19. # ----- PRIVATE
  20.  
  21. _Lang_SetLanguage{
  22. $__c=$KM_Locale==$ARG?YES:confirm(_("You have to restart K-Meleon to make this change take effect everywhere.\n\nDo you really want to change the GUI's language?"),_("Change Language"),YESNO);
  23. $__c==YES?&_Lang_SetLang:0;
  24. }
  25. _Lang_SetLang{
  26. setpref(STRING,"general.useragent.locale",$_Lang_SetLanguage);
  27. setpref(STRING,"general.useragent.contentlocale",substr($_Lang_SetLanguage,3));
  28. $KM_Locale=$_Lang_SetLanguage; $__x="resource:///"; $__y="locales/"; $__z="readme.html";
  29. $__s=getpref(STRING,$KM_Homepage);
  30. $__b=(($__s==$__x.$__z)+(index($__s,$__x.$__y)==0)*(index($__s,$__z)==length($__s)-length($__z)));
  31. $__s=$_Lang_SetLanguage=="en-US"?$__x.$__z:$__x.$__y.$_Lang_SetLanguage."/".$__z;
  32. $__b?setpref(STRING,$KM_Homepage,$__s):0; 
  33. }
  34.  
  35. _Lang_BuildMenu{
  36. $_l="Lan&guage"; $_c=$Lang_Codes; $_n=$Lang_Names;
  37. setmenu(Preferences,popup,$_l);
  38. while($_c) &_Lang_BuildMenuLoop;
  39. }
  40. _Lang_BuildMenuLoop{
  41. setmenu($_l,macro,substr($_n,0,index($_n,";")),"Lang_SetLanguage(".substr($_c,0,index($_c,";")).")");
  42. $_c=substr($_c,index($_c,";")+1);
  43. $_n=substr($_n,index($_n,";")+1);
  44. }
  45. $OnInit=$OnInit."_Lang_BuildMenu;";
  46.  
  47. # ------------------------------------------------------------------------------------------------------------------
  48. $macroModules=$macroModules."Lang;";