2014-08-04 12:12:15 +00:00
|
|
|
// vim: set ts=4 sw=4 tw=99 noet:
|
|
|
|
//
|
|
|
|
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
|
|
// Copyright (C) The AMX Mod X Development Team.
|
|
|
|
//
|
|
|
|
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
|
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
|
|
// https://alliedmods.net/amxmodx-license
|
|
|
|
|
|
|
|
//
|
|
|
|
// Language Functions
|
|
|
|
//
|
2004-07-30 14:29:20 +00:00
|
|
|
|
|
|
|
#if defined _lang_included
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _lang_included
|
|
|
|
|
2018-07-10 12:42:45 +00:00
|
|
|
/**
|
|
|
|
* Returns the number of languages loaded.
|
|
|
|
*
|
|
|
|
* @return Number of languages loaded.
|
|
|
|
*/
|
2004-07-30 14:29:20 +00:00
|
|
|
native get_langsnum();
|
|
|
|
|
2018-07-10 12:42:45 +00:00
|
|
|
/**
|
|
|
|
* Returns the two-letter name of a language returned by get_langsnum()
|
|
|
|
*
|
|
|
|
* @param id Language index, starting at 0
|
|
|
|
* @param name Buffer to store the name in
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
*/
|
2004-07-30 14:29:20 +00:00
|
|
|
native get_lang(id, name[3]);
|
|
|
|
|
2018-07-10 12:42:45 +00:00
|
|
|
/**
|
|
|
|
* Registers a dictionary file, making sure the words are in the dictionary.
|
|
|
|
*
|
|
|
|
* @note The file should be in "addons/amxmodx/data/lang", but only the name
|
|
|
|
* needs to be given. For example, register_dictionary("file.txt") will
|
|
|
|
* be "addons/amxmodx/data/lang/file.txt".
|
|
|
|
*
|
|
|
|
* @param filename Dictionary file name
|
|
|
|
*
|
|
|
|
* @return On success, the function will return 1, otherwise it will
|
|
|
|
* return 0 if the file couldn't be found or opened, and -1 if
|
|
|
|
* the dictionary was already registered by a plugin
|
|
|
|
*/
|
2004-07-30 14:29:20 +00:00
|
|
|
native register_dictionary(const filename[]);
|
|
|
|
|
2018-07-10 12:42:45 +00:00
|
|
|
/**
|
|
|
|
* Checks if the language is loaded.
|
|
|
|
*
|
|
|
|
* @return 1 if it is, 0 otherwise
|
|
|
|
*/
|
2006-08-28 11:08:18 +00:00
|
|
|
native lang_exists(const name[]);
|
|
|
|
|
2006-09-12 07:59:56 +00:00
|
|
|
enum TransKey
|
|
|
|
{
|
|
|
|
TransKey_Bad = -1,
|
|
|
|
};
|
|
|
|
|
2006-08-28 11:08:18 +00:00
|
|
|
/**
|
2018-07-10 12:42:45 +00:00
|
|
|
* Creates a new or finds an existing translation key.
|
|
|
|
*
|
|
|
|
* @param key Key to create or find
|
|
|
|
*
|
|
|
|
* @return Key index
|
2006-08-28 11:08:18 +00:00
|
|
|
*/
|
|
|
|
native TransKey:CreateLangKey(const key[]);
|
2018-07-10 12:42:45 +00:00
|
|
|
|
2006-09-12 07:59:56 +00:00
|
|
|
/**
|
2018-07-10 12:42:45 +00:00
|
|
|
* Finds a translation key index without adding on failure.
|
|
|
|
*
|
|
|
|
* @param key Key to search for
|
|
|
|
*
|
|
|
|
* @return Key index, or -1 if not found
|
2006-09-12 07:59:56 +00:00
|
|
|
*/
|
|
|
|
native TransKey:GetLangTransKey(const key[]);
|
2018-07-10 12:42:45 +00:00
|
|
|
|
2006-08-28 11:08:18 +00:00
|
|
|
/**
|
2018-07-10 12:42:45 +00:00
|
|
|
* Adds a new translation.
|
|
|
|
*
|
|
|
|
* @param lang Two-letter language name
|
|
|
|
* @param key Language key
|
|
|
|
* @param phrase Translated text
|
|
|
|
*
|
|
|
|
* @noreturn
|
2006-08-28 11:08:18 +00:00
|
|
|
*/
|
|
|
|
native AddTranslation(const lang[3], TransKey:key, const phrase[]);
|
2007-04-20 02:55:59 +00:00
|
|
|
|
|
|
|
/**
|
2018-07-10 12:42:45 +00:00
|
|
|
* Looks up the translation of the key for the given type.
|
|
|
|
*
|
|
|
|
* @note This does NOT format the output text! For example, if the key
|
|
|
|
* contains %s, the outputted text will also contain %s.
|
|
|
|
* @note LANG_PLAYER is invalid in this, use a player index or LANG_SERVER.
|
|
|
|
*
|
|
|
|
* @param Output Buffer to store the output in
|
|
|
|
* @param OutputSize Maximum buffer size
|
|
|
|
* @param Key Language key
|
|
|
|
* @param id Client index or LANG_SERVER
|
|
|
|
*
|
|
|
|
* @return 1 on success, 0 otherwise
|
2007-04-20 02:55:59 +00:00
|
|
|
*/
|
2015-03-11 13:19:27 +00:00
|
|
|
native LookupLangKey(Output[], OutputSize, const Key[], &id);
|
2015-03-26 15:40:39 +00:00
|
|
|
|
|
|
|
/**
|
2018-07-10 12:42:45 +00:00
|
|
|
* Sets the global language target.
|
2015-03-26 15:40:39 +00:00
|
|
|
*
|
|
|
|
* @note This is useful for creating functions
|
2018-07-10 12:42:45 +00:00
|
|
|
* that will be compatible with the %l format specifier. Note that invalid
|
2015-03-26 15:40:39 +00:00
|
|
|
* indexes can be specified but the error will occur during translation,
|
|
|
|
* not during this function call.
|
|
|
|
*
|
|
|
|
* @param client Client index or LANG_SERVER
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
native SetGlobalTransTarget(client);
|