![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
grunt-static-i18n
Advanced tools
Grunt plugin to translate static assets.
Say you have:
app
├── locale
│ ├── en_GB
│ │ └── LC_MESSAGES
│ │ └── messages.po
│ └── fr
│ └── LC_MESSAGES
│ └── messages.po
└── static
└── data.json // content: ["_('Hello World')"]
And you need to translate data.json
.
Static internationalization would like like:
app
├── i18n
│ ├── en_GB
│ │ └── static
│ │ └── data.json // content: ["Hello World"]
│ └── fr
│ └── static
│ └── data.json // content: ["Bonjour tout le monde"]
├── locale
│ ├── en_GB
│ │ └── LC_MESSAGES
│ │ └── messages.po
│ └── fr
│ └── LC_MESSAGES
│ └── messages.po
└── static
└── data.json
This plugin requires Grunt.
Translations are done with node-gettext and you will need a proper
gettext catalog (structure seen above). If need help extracting translation
strings, checkout grunt-i18n-abide.
Checkout the makemessages
task in Gruntfile.js.
In your project's Gruntfile, add a section named statici18n
to the data
object passed into grunt.initConfig()
:
grunt.initConfig({
statici18n: {
options: {
localeDir: 'app/locale'
},
myAppTask: {
files: [{
expand: true,
cwd: 'app',
src: 'static/*.json',
dest: 'app/i18n'
}]
}
}
})
Type: String
Default value: locale
Sometimes easiest to use a var, say <%= abideCreate.options.localeDir %>
Type: RegEx
Default: search for _('msgid')
or _("msgid")
Used to find gettext calls.
Sets _.templateSettings.interpolate
Run grunt && open coverage.html
Copyright (c) 2014 Douglas Beck. Licensed under the MIT license.
0.0.2
Adds coverage reporting.
FAQs
Grunt plugin to translate static assets.
The npm package grunt-static-i18n receives a total of 11 weekly downloads. As such, grunt-static-i18n popularity was classified as not popular.
We found that grunt-static-i18n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.