moonspeak/README.md

91 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2022-08-10 17:56:55 +02:00
moonspeak - LÖVE game localization library
==========================================
2022-08-10 17:23:18 +02:00
**moonspeak** is a basic internationalization library for
the [LÖVE](https://love2d.org/) engine.
It makes your game easy to translate to multiple languages.
2022-08-10 17:23:18 +02:00
**moonspeak** does the following:
* Loads dictionary files for your game.
* Allows selecting one of the many available languages.
* Translates messages by id (and provides default fallback to English).
2022-08-10 17:23:18 +02:00
## Dependencies
2022-08-10 17:23:18 +02:00
**moonspeak** uses [df-serialize](https://codeberg.org/1414codeforge/df-serialize)
2022-08-10 17:23:18 +02:00
to read the dictionary file.
You may either doenload **df-serialize** manually and place it inside a `lib` subdirectory,
or use [crush](https://codeberg.org/1414codeforge/crush)
to do this for you.
2022-08-10 17:23:18 +02:00
## Using crush to download moonspeak dependencies
1. Clone this repository.
```sh
git clone https://codeberg.org/1414codeforge/moonspeak
```
2. Move to repository root directory:
```sh
cd moonspeak
```
3. Resolve dependencies using **crush**.
```sh
lua crush.lua
```
You should now see a `lib` subdirectory containing the necessary dependencies.
## Integrating moonspeak in my project using crush
1. Download the latest [crush.lua](https://codeberg.org/1414codeforge/crush/src/branch/master/crush.lua) file and
place it in your project's root directory.
2. Create a `.lovedeps` text file in your project's root with the following dependency entry:
```lua
{
moonspeak = "https://codeberg.org/1414codeforge/moonspeak",
-- ...more dependencies, if necessary...
}
```
2022-08-17 15:51:20 +02:00
3. `moonspeak` can now be downloaded directly by `crush` to the project's `lib` directory:
```sh
lua crush.lua
```
2022-08-17 15:51:20 +02:00
4. Now `moonspeak` can be `require()`d in your code, like this:
```lua
local moonspeak = require 'lib.moonspeak'
```
2022-08-17 15:51:20 +02:00
5. Any project depending on yours will now fetch `moonspeak`
automatically when using `crush`, following the above procedure.
## Documentation
2022-08-10 17:23:18 +02:00
Code is documented with [LDoc](https://github.com/lunarmodules/LDoc).
Documentation may be generated running the command:
```sh
ldoc init.lua
```
`ldoc` outputs to a local `doc` directory, open `index.html`
with your favorite browser to read it.
## License
2022-08-10 17:23:18 +02:00
Zlib, See [LICENSE](LICENSE) for details.