Dotlang is the official library yua uses to parse the .lang translation files and utilize them
npm i dotlang
const dotlang = require('dotlang')
const single = dotlang.parse('path/to/dotlang/file.lang')
console.log(single)
const multiple = dotlang.parseMultiple([
'path/to/dotlang/file.lang',
'path/to/another/dotlang/file.lang'
])
console.log(multiple)
const dir = dotlang.parseAllInDir('path/to/dir')
console.log(dir)
Parameters | Type | Description |
---|---|---|
path |
string |
Path to .lang file |
Parse lang file and return map
Parameters | Type | Description |
---|---|---|
paths |
string[] |
Array of .lang file paths |
Parse multiple lang files and return map
Parameters | Type | Description |
---|---|---|
dir |
string |
Path to directory |
Finds all lang files in a directory and parses them
Map(int) {
'key' => 'value'
}
Map(int) {
'fileName' => Map(int) {
'key' => 'value'
}
}
# Parser Will Ignore comments, use hashtag to comment
dotlang.hello=Hi, I am grateful you found dis lib :)
dotlang.abnormal = Spaces Will Not Affect Parser
# Extra
dotlang.meta.description = Pretty Quickly thrown together lib probably has issues
If you would like your .lang files to be colorized try using our extension dotlang
Also something to note, keys are not required to be concatenated with dots
eg: dotlang-weird=lel
will work too. I just prefer dots :)
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.