2.2.4 โข Published 2 years ago
mewwme-localpride v2.2.4
mewwme-localpride
- This is a YAML based localisation system that will make your job quite easy
- Just create your language folder and seperate everything in files
- Set your constants in
constants.yamland apply to everything
๐ฆ Installation
$ npm install mewwme-localpride๐ Usage
import { I18n } from "mewwme-localpride";
/*
options:
directory?: string;
defaultLocale: string;
*/
const parser = new I18n({
defaultLocale: "en",
});
parser.getLocales(); // => [ "en", "id" ];
parser.getConstant(); // => all constants;
parser.getConstant("owner"); // => "owner" constant;
parser.toJSON(); // => all language data in an object
parser.toJSON({ arg: "this is an argument" }); // => all language data in an object with argument replaced
parser.get("en", "info", "test"); // "test" string in "info" section in "en" folder
parser.get("id", "messages", "message", { arg: "this is an argument" }); // "message" string in "messages" section in "id" folder with "arg" argument๐ File Structure
locales/constants.yaml example
owner: lrmn7
site: "https://is-a.fun"
anotherConstant: this is a constantlocales/{locale}/{section}.yaml example
withConstant: this string uses %{owner} constant
withArgs: this string uses %{argument} argument and %{anotherArgument} argument
withConstantsAndArguments: this string uses %{simpleArgument} argument and %{site} constant๐ Folder Structure
๐ locales/
โโโโ ๐ constants.yaml
โโโโ ๐ en
โ โโโโ ๐ info.yaml
โ โโโโ ๐ messages.yaml
โ โโโโ ๐ test.yaml
โโโโ ๐ id
โโโโ ๐ info.yaml
โโโโ ๐ messages.yaml
โโโโ ๐ test.yaml๐งฆ Looking For Contributors
We are looking for contributors to actively work on Mewwme and to contribute to the repos. There is still lots of work to do. If you are interested in contributing, please join our Discord server. (There will be a surprise for early contributors!)
๐ License
Copyright ยฉ 2022 lrmn7.
Distributed under the GPL-3.0 License. See LICENSE for more information.
๐งฆ Contributing
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/my-feature) - Run prettier (
npm run format) - Commit your Changes (
git commit -m 'my awesome feature my-feature') - Push to the Branch (
git push origin feature/my-feature) - Open a Pull Request
โญ๏ธ Show your support
Give a โญ๏ธ if this project helped you!
โ๏ธ Contact
- Mail: lrmn.dev@gmail.com
- Discord: https://discord.gg/mewwme
- Website: https://is-a.fun
2.2.4
2 years ago