# HRLib

## Installation

* Download [HRLib](https://github.com/HRScripts/HRLib)
* Configure its `config.lua` file
* Add `ensure HRLib` to the top of the list with resources to start in your `server.cfg`&#x20;
* Restart your server

## Configuration

Here we allow you to see what you're about to configure before starting HRLib

```lua
local config = {}

config.defaultWebHook = 'https://discord.com/api/webhooks/********************' -- Default webhook URL for the `HRLib.DiscordMsg` function (not required)

config.defaultNotificationsPosition = 'left-center' -- available positions - 'top-right', 'center-right', 'bottom-right', 'frombelow-right', 'top-left', 'left-center', 'frombelow-left'

config.defaultProgressBarPosition = 'bottom-center' -- available positions - 'center-left', 'center', 'center-right', 'bottom-left', 'bottom-center', 'bottom-right'

config.alertDialogueTranslation = {
    agreeButton = 'Agree',
    cancelButton = 'Cancel'
}

config.inputDialogueTranslation = {
    confirmButton = 'Confirm',
    cancelButton = 'Cancel'
}

config.debug = {
    enable = true,
    commandName = 'hrlib_debug',
    commandHelp = 'Debug command of HRLib',
    args = {
        type = {
            name = 'functionType',
            help = 'Available types: showTextUI, isTextUIOpen, hideTextUI, progressBar, alertDialogue, inputDialogue, notify'
        },
        secondParameter = {
            name = '...',
            help = 'it changes according to the chosen function type'
        }
    }
}
```

## Get functions list methods

### Export method

```lua
HRLib = exports.HRLib:getLibFunctions()
```

### Import method

Add this to your fxmanifest.lua:

```lua
shared_script '@HRLib/import.lua'
```

## Translation system

The translation system allows you to translate your scripts, more organized and optimized.

### Installation

* Create your own translation.lua file directly into your script's folder
* Add this to your fxmanifest.lua\
  `file 'translation.lua'`&#x20;
* Create your own config.lua file which should provide global variable `Config` or\
  local one and should return it at the end of the file (as import module) but it's supposed to return the config table with a field `language` if not in that way, the global `Config` variable must have the `language` field in it so the translation can work properly
* Add this to your fxmanifest.lua\
  If you choose to do it with global variable, add this:\
  `shared_script 'config.lua'` (add it after the row with adding the import method)\
  If you choose to do it with the local variable and return the config, add this:\
  `files {`\
  &#x20;   `'translation.lua',`\
  &#x20;   `'config.lua'`\
  `}`&#x20;
* Refresh & Restart the script

{% hint style="warning" %}
The translation is only available in import method!
{% endhint %}
