A super simple express middleware for localization. To use it, you need to have locale installed.
Localizer reads all the files in a folder called languages in your current directory and parses them, by key-value principle.
It exports two methods:
This method reads all the files in options.path and parses them all.
This method is the middleware, which adds the next method req.localize to the request object.
This method tries to find a key in the languages dictionar which matches. If it cannot find it, it just returns the key.
The way how it tries to find the value is by the following order,
req.localevalue if this doesn't exist- it just gets the
defaultvalue from thedefault.jsonfile if this isn't present - it just returns the key
- Tests
- Configuration of languages path