LlGetAgentLanguage
From Second Life Wiki
| LSL Portal | | | Functions | | | Events | | | Types | | | Operators | | | Constants | | | Flow Control | | | Script Library | | | Tutorials |
Description
Function: string llGetAgentLanguage( key avatar );| 336 | Function ID |
| 0.0 | 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 |
|---|---|
| "de" | German |
| "en-us" | US English |
| "es" | Spanish |
| "fr" | French |
| "ja" | Japanese |
| "pt" | Portuguese |
| "ko" | Korean |
| "zh" | Chinese |
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.
Examples
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+"!"); } } } }
This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.

