SQLiteLang - Discussions / Ideas Thread
#1

sqlitelang.inc - SQLite based include that easily allows to manipulate multilanguage strings.
"Creating multilanguage gamemodes has never been easier."
Include not yet released.

Hello everyone.

I am currently working on a new include named SQLiteLang. I am not yet releasing it because I am still working on a first release, however I would like to get some ideas and maybe some discussion about it.

First off, to be honest this include is similar to y_language from a certain point of view, however SQLite makes it way more developer-friendly and adds many functions that allow developers to add, modify, delete or manipulate in any possible way the strings in-game!

Developers will be able to make systems to allow users giving a contribute to the server making user-made translations for their own language, for example. These are the functions I am currently planning to create:
  • (DONE!) SQLiteLang_Initialize(file[])
  • (DONE!) SQLiteLang_Terminate()
  • (DONE!) SQLiteLang_AddIdentifierString(identifier[], description[])
  • TODO: SQLiteLang_DeleteIdentifier(identifier[])
  • TODO: SQLiteLang_ModifyIdentifierDescription(identifier[], new_desc[])
  • (DONE!) SQLiteLang_AddString(identifier[], lang[], string[])
  • TODO: SQLiteLang_DeleteString(identifier[], lang[])
  • TODO: SQLiteLang_ModifyString(identifier[], lang[], new_string[])
  • (DONE!) SQLiteLang_AddLanguage(lang[], description[])
  • (DONE!) SQLiteLang_DeleteLanguage(lang[])
  • TODO: SQLiteLang_ModifyLanguage(old_lang[], new_lang[])
  • TODO: SQLiteLang_ModifyLanguageDescription(lang[], new_desc[])
  • TODO: SQLiteLang_ShowLanguageString(identifier[], lang[])
  • TODO: SQLiteLang_ShowPlayerString(playerid, identifier[])
  • TODO: SQLiteLang_SetDefaultLang(lang[])
  • TODO: SQLiteLang_SetPlayerLang(playerid, lang[])
  • (DONE!) SQLiteLang_IsIdentifierValid(identifier[])
  • (DONE!) SQLiteLang_IsLanguageValid(lang[])
  • (DONE!) SQLiteLang_IsStringValid(identifier[], lang[])
Here's some documentation of the functions I have already made:

pawn Code:
/*
 * SQLiteLang_Initialize
 * This function declares the name of the database and saves it into a variable (both file and directory).
 * If the database does not exist, a new one will be created by default in the folder 'SQLiteLang'.
 *
 * optional: file[] ("SQLiteLang/Database.db") = Directory and file name of the database.
 * optional: debug (false) = Turning this on will activate the debugging mode.
*/


/*
 * SQLiteLang_Terminate
 * This function terminates the usage of the include and resets the saved name and directory of the database internally to default.
*/


/*
 * SQLiteLang_AddIdentifierString
 * This function adds a new string identifier to the database.
 *
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
 * description[] = The description of the identifier (ie. "string that welcomes new players in the server").
*/


/*
 * SQLiteLang_AddString
 * This function adds a new string to the database.
 *
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
 * string[] = The string is the actual string of text to show in different languages.
*/


/*
 * SQLiteLang_AddLanguage
 * This function adds a new language to the database.
 *
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
 * description[] = The description of the language (ie. "English" or "Italian Language" or "{FFFFFF}Spanish").
*/


/*
 * SQLiteLang_DeleteLanguage
 * This function deletes a specific language from database.
 * Be careful, deleting a language will delete all the language strings already added in the database.
 * Furthermore, you may not delete the default language, if set.
 *
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
*/


/*
 * SQLiteLang_DeleteIdentifier
 * This function deletes all the language strings of a specific identifier from the database.
 *
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
*/


/*
 * SQLiteLang_DeleteString
 * This function deletes a specific language string of a specific identifier from the database.
 *
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
*/


/*
 * SQLiteLang_ModifyString
 * This function modify a specific language string in database.
 *
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
 * new_string[] = The string is the new actual string of text to show in different languages that will replace the old one.
*/


/*
 * SQLiteLang_ShowLanguageString
 * This function shows a specific language string taken from the database.
 *
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
*/


/*
 * SQLiteLang_ShowPlayerString
 * This function shows a specific language string taken from the database.
 *
 * playerid = playerid of the player.
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
*/


/*
 * SQLiteLang_SetDefaultLang
 * This function sets the default language for users that haven't selected an available language.
 *
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
*/


/*
 * SQLiteLang_SetPlayerLang
 * This function sets the language of a player.
 *
 * playerid = playerid of the player.
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
*/


/*
 * SQLiteLang_IsIdentifierValid
 * This function checks if an identifier exists.
 *
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
*/


/*
 * SQLiteLang_IsLanguageValid
 * This function checks if a language exists.
 *
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
*/


/*
 * SQLiteLang_IsStringValid
 * This function checks if a string already exists.
 *
 * identifier[] = The identifier is used to identify, as the parameter says, every string of text (ie. "welcome_string").
 * lang[] = The lang is used to identify the language of the string (ie. "en" or "IT" or "spanish").
*/
The include will be released on GitHub as soon the first (working) release will be ready.
Meanwhile, I would love to have some feedback and discussion about it!

Cheers.
Reply
#2

Released: https://sampforum.blast.hk/showthread.php?tid=468073
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)