plugins/include/lang.inc
author Nicholas Hastings <skamonkey@gmail.com>
Fri Aug 30 14:15:02 2013 -0400 (2013-08-30)
changeset 4102 0eb66c45a884
parent 3967 ceafb87d38a7
permissions -rw-r--r--
Reserved slot fixes for OB games when SourceTV or Replay are enabled (bug 5499, r=drifter).
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     5  * =============================================================================
     6  *
     7  * This file is part of the SourceMod/SourcePawn SDK.
     8  *
     9  * This program is free software; you can redistribute it and/or modify it under
    10  * the terms of the GNU General Public License, version 3.0, as published by the
    11  * Free Software Foundation.
    12  * 
    13  * This program is distributed in the hope that it will be useful, but WITHOUT
    14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    15  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    16  * details.
    17  *
    18  * You should have received a copy of the GNU General Public License along with
    19  * this program.  If not, see <http://www.gnu.org/licenses/>.
    20  *
    21  * As a special exception, AlliedModders LLC gives you permission to link the
    22  * code of this program (as well as its derivative works) to "Half-Life 2," the
    23  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    24  * by the Valve Corporation.  You must obey the GNU General Public License in
    25  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    26  * this exception to all derivative works.  AlliedModders LLC defines further
    27  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    28  * or <http://www.sourcemod.net/license.php>.
    29  *
    30  * Version: $Id$
    31  */
    32 
    33 #if defined _lang_included
    34  #endinput
    35 #endif
    36 #define _lang_included
    37 
    38 #define LANG_SERVER		0		/**< Translate using the server's language */
    39 
    40 /**
    41  * Loads a translation file for the plugin calling this native.
    42  * If no extension is specified, .txt is assumed.
    43  *
    44  * @param file		Translation file.
    45  * @noreturn
    46  */
    47 native LoadTranslations(const String:file[]);
    48 
    49 /**
    50  * Sets the global language target.  This is useful for creating functions
    51  * that will be compatible with the %t format specifier.  Note that invalid
    52  * indexes can be specified but the error will occur during translation,
    53  * not during this function call.
    54  *
    55  * @param client	Client index or LANG_SERVER.
    56  * @noreturn
    57  */
    58 native SetGlobalTransTarget(client);
    59 
    60 /**
    61  * Retrieves the language number of a client.
    62  * Currently this simply returns the server language index.
    63  *
    64  * @param client	Client index.
    65  * @return			Language number client is using.
    66  * @error			Invalid client index or client not connected.
    67  */
    68 native GetClientLanguage(client);
    69 
    70 /**
    71  * Retrieves the server's language.
    72  *
    73  * @return			Language number server is using.
    74  */
    75 native GetServerLanguage();
    76 
    77 /**
    78  * Returns the number of languages known in languages.cfg.
    79  *
    80  * @return			Language count.
    81  */
    82 native GetLanguageCount();
    83 
    84 /**
    85  * Retrieves info about a given language number.
    86  *
    87  * @param language	Language number.
    88  * @param code		Language code buffer (2-3 characters usually).
    89  * @param codeLen	Maximum length of the language code buffer.
    90  * @param name		Language name buffer.
    91  * @param nameLen	Maximum length of the language name buffer.
    92  * @noreturn
    93  * @error			Invalid language number.
    94  */
    95 native GetLanguageInfo(language, String:code[]="", codeLen=0, String:name[]="", nameLen=0);
    96 
    97 /**
    98  * Sets the language number of a client.
    99  *
   100  * @param client	Client index.
   101  * @param language	Language number.
   102  * @noreturn
   103  * @error			Invalid client index or client not connected.
   104  */
   105 native SetClientLanguage(client, language);
   106 
   107 /**
   108  * Retrieves the language number from a language code.
   109  *
   110  * @param code		Language code (2-3 characters usually).
   111  * @return			Language number. -1 if not found.
   112  */
   113 native GetLanguageByCode(const String:code[]);
   114 
   115 /**
   116  * Retrieves the language number from a language name.
   117  *
   118  * @param name		Language name (case insensitive).
   119  * @return			Language number. -1 if not found.
   120  */
   121 native GetLanguageByName(const String:name[]);