llGetAgentLanguage

From Second Life Wiki
Revision as of 07:28, 26 January 2012 by Kireji Haiku (talk | contribs)
Jump to navigation Jump to search

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.
  • During a 1-5 seconds period after which an agent is logging in, this function will return an empty string as well, until the viewer sends the data to the simulator.
  • 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 {

   touch_start(integer num_detected)
   {
       key id = llDetectedKey(0);
       string name = llDetectedName(0);
       string language = llGetAgentLanguage(id);
       //if no information sent by viewer, set back to default English
       if (language == "") language = "en-us";
       // PUBLIC_CHANNEL is 0
       if (language == "en-us")
           llSay(PUBLIC_CHANNEL, "Hi there, " + name + "!");
       else if (language == "es")
           llSay(PUBLIC_CHANNEL, "¡Hola, " + name + "!");
       else if (language == "fr")
           llSay(PUBLIC_CHANNEL, "Salut, "+name+" !");
       else if (language == "ja")
           llSay(PUBLIC_CHANNEL, "やあ、 " + name + "!");
       else if (language == "de")
           llSay(PUBLIC_CHANNEL, "Hallo, " + name + "!");
       else if (language == "pt")
           llSay(PUBLIC_CHANNEL, "Olá!, " + name + "!");
       else if (language == "ko")
           llSay(PUBLIC_CHANNEL, "안녕하세요, " + name + "!");
       else if (language == "zh")
           llSay(PUBLIC_CHANNEL, "你好啊, " + name + "!");
       }
   }

}

</lsl>

Deep Notes

History

Signature

function string llGetAgentLanguage( key avatar );