Difference between revisions of "LlGetAgentLanguage"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 5: Line 5:
|p1_type=key|p1_name=avatar|p1_desc
|p1_type=key|p1_name=avatar|p1_desc
|return_type=string
|return_type=string
|return_text=that is the language code of the preferred interface language of the user '''avatar'''.  
|return_text=that is the language code of the preferred interface language of the user {{LSLP|avatar}}.  
|func_desc
|func_desc
|func_footnote
|func_footnote

Revision as of 21:18, 19 June 2012

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)
If the viewer is set to "System Default" the possible return may not be in this list. See List of ISO 639-1 codes for reference.

The value can also be modified by directly editing the settings.xml file or with debug settings. So the value returned by llGetAgentLanguage may not be an ISO 639-1 value at all.

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.
  • Viewers can specify other arbitrary language strings with the 'InstallLanguage' debug setting. For example, launching the viewer with "--set InstallLanguage american" results this function returning 'american' for the avatar. VWR-12222
    • If the viewer supplies a multiline value, the simulator will only accept the first line and ignore all others. SVC-5503

Examples

<lsl> default{

   touch_start( integer num_detected ){
       string name;
       string language;
       
       //-- loop through all detected touches
       for (num_detected -= 1; num_detected > -1; num_detected -= 1 ){
           name = llDetectedName( num_detected );
           language = llGetAgentLanguage( llDetectedKey( num_detected ) );
           //-- PUBLIC_CHANNEL is 0
           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 + "!" );
           }else{ //-- Default to english if language is unrecognized \ not provided.
               llSay( PUBLIC_CHANNEL, "Hi there, " + name + "!" );
           }
       }
   }
}</lsl>

Deep Notes

History

Signature

function string llGetAgentLanguage( key avatar );