Difference between revisions of "LlGetAgentLanguage"

From Second Life Wiki
Jump to navigation Jump to search
m (added note re "System Default" setting)
(That's more than a note!)
Line 10: Line 10:
*Users may prefer to see the client interface in a language that is not their native language, and some may prefer to use objects in the native language of the creator, or dislike low-quality translations. Consider providing a manual language override when it is appropriate.
*Users may prefer to see the client interface in a language that is not their native language, and some may prefer to use objects in the native language of the creator, or dislike low-quality translations. Consider providing a manual language override when it is appropriate.
*New language/variant values may be added later. Scripts may need to be prepared for unexpected values.
*New language/variant values may be added later. Scripts may need to be prepared for unexpected values.
*If the viewer is set to "System Default" the possible return may be outside the list given above. see [http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes List of ISO 639-1 codes] for reference.
|examples=<lsl>default {
|examples=<lsl>default {
     state_entry() {
     state_entry() {
Line 46: Line 47:
|also_tests
|also_tests
|also_events
|also_events
|notes=* If the viewer is set to "System Default" the possible return may be outside the list given above. see [http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes List of ISO 639-1 codes] for reference.
|notes
|history=Introduced in {{SVN|568|rev=88085|branch=Release|anchor=file33|date=Wednesday, 21 May 2008}}
|history=Introduced in {{SVN|568|rev=88085|branch=Release|anchor=file33|date=Wednesday, 21 May 2008}}
|cat1=Avatar
|cat1=Avatar

Revision as of 00:56, 31 July 2009

Summary

Function: string llGetAgentLanguage( key avatar );
0.0 Forced Delay
10.0 Energy

Returns a string that is the language code of the preferred interface language of the user avatar.

• key avatar avatar UUID that is in the same region

Return Description
"en" English
"da" Dansk (Danish)
"de" Deutsch (German)
"es" Español (Spanish)
"fr" Français (French)
"it" Italiano (Italian)
"hu" Magyar (Hungarian)
"nl" Nederlands (Dutch)
"pl" Polski (Polish)
"pt" Portugués (Portuguese)
"ru" Русский (Russian)
"tr" Türkçe (Turkish)
"uk" Українська (Ukrainian)
"zh" 中文 (简体) (Chinese)
"ja" 日本語 (Japanese)
"ko" 한국어 (Korean)

Caveats

  • If the user has "Share language with objects" disabled then this function returns an empty string.
  • Users may prefer to see the client interface in a language that is not their native language, and some may prefer to use objects in the native language of the creator, or dislike low-quality translations. Consider providing a manual language override when it is appropriate.
  • New language/variant values may be added later. Scripts may need to be prepared for unexpected values.
  • If the viewer is set to "System Default" the possible return may be outside the list given above. see List of ISO 639-1 codes for reference.

Examples

<lsl>default {

   state_entry() {
   }
   touch_start(integer n) {
       integer i;
       for(i=0;i<n;i++) {
           string name=llDetectedName(i);
           string lang=llGetAgentLanguage(llDetectedKey(i));
           if(lang=="") lang="en-us"; // Default to English.
           if(lang=="en-us") {
               llSay(0,"Hi there, "+name+"!");
           }else if(lang=="es") {
               llSay(0,"¡Hola, "+name+"!");
           }else if(lang=="fr") {
               llSay(0,"Salut, "+name+" !");
           }else if(lang=="ja") {
               llSay(0,"やあ、 "+name+"!");
           }else if(lang=="de") {
               llSay(0,"Hallo, "+name+"!");
           }else if(lang=="pt") {
               llSay(0,"Olá!, "+name+"!");
           }else if(lang=="ko") {
               llSay(0,"안녕하세요, "+name+"!");
           }else if(lang=="zh") {
               llSay(0,"你好啊, "+name+"!");
           }
       }
   }

}

</lsl>

Deep Notes

History

Signature

function string llGetAgentLanguage( key avatar );