
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Hey! Sorry for any delays! gengo.js has been through some transitions and hopefully it lead it to a better library but here's what happened:
In the coming weeks I will be working on a revamped version of the website/documentation with the updated gengo.js. In the meantime, please don't hesitate to create issues and/or contribute to this awesome open source project. And to let everyone know, I am looking for maintainers. This project isn't very big and shouldn't be difficult to understand on how it works, so if you are interested, feel free to DM me through Gitter or Twitter (@iwatakeshi). :)
It's here! It's finally here! Welcome to version 1.0.0-alpha. As the version implies, this version of gengo is not production ready. It's published so that I can get some feedback and of course test it myself. In fact, I already have a couple of thoughts about bringing the core and the plugins into the same repo because individually maintaining them myself is a difficult task. In the meantime, feel free to try it out and report any bugs or suggestions. As far as docs are concerned, it may take a while for me to write as I try to organize everything up and make gengo.js simple enough to extend and make it the best i18n module for Node.
gengo.js is an i18n/l10n library that is powered by it's very small core. Along with the core, it is also managed by six plugins. The combinations of the these create a powerful and a unique library that enables developers to take over the core and extend its capabilities. The core is essentialy an empty shell that provides the basics such as a way of accessing a plugin's options or the plugin itself. As a starter, begin hacking the core and the plugins to find out how you can develop your own plugins and create the ultimate combination to create the best i18n library for Node.js.
// Modules used in example
var path = require('path');
// Options used in example
var options = {
parser: {
type: '*'
},
backend: {
directory: path.join(__dirname, '/config/locales/')
},
header: {
supported: ['en-US', 'ja']
}
};
// Express
var gengo = require('gengojs');
var app = require('express')();
// Use gengo
app.use(gengo(options));
// Koa
var gengo = require('gengojs/koa');
var app = require('koa')();
// Use gengo
app.use(gengo(options));
// Hapi
var server = new require('hapi').Server();
var gengo = require('../../hapi/');
// Register gengo
server.register(gengo(options), function(error) {
if (error) console.log('an error occurred: ' + error);
});
These are the complete option for the official plugins. Loading options is quite simple in gengo.js.
{
"api" : {
"global": "__",
"localize": "__l"
},
"backend": {
"directory": "./locales",
"extension": "json",
"prefix": "",
"cache": true
},
"header": {
"detect": {
"query": false,
"subdomain": false,
"url": false,
"cookie": false,
"header": true
},
"keys": {
"cookie": "locale",
"query": "locale"
},
"supported": ["en-US"],
"default": "en-US"
},
"parser": {
"type": "default",
"markdown": {
"enabled": false,
"html": false,
"xhtmlOut": false,
"breaks": false,
"langPrefix": "language-",
"linkify": false,
"typographer": false,
"quotes": "“”‘’"
},
"template": {
"enabled": true,
"open": "{{",
"close": "}}"
},
"sprintf": { "enabled": true },
"keywords": {
"default": "default",
"translated": "translated",
"global": "global"
}
},
"router": { "enabled": true }
}
There are three file extensions supported:
Each plugin have their own defaults (if applicable) but to override them simply use one of the following ways:
gengo('path to options');
gengo({
"parser": {/* ... */}
});
# make sure to install the node modules
npm install
# run test
gulp test
FAQs
the best i18n middleware for Node.js
The npm package gengojs receives a total of 14 weekly downloads. As such, gengojs popularity was classified as not popular.
We found that gengojs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.