@open-xchange/vite-plugin-po2json
v1.1.0
Published
A Vite plugin to load po files into our gettext based dictionary implementation.
Maintainers
Keywords
Readme
Vite Plugin PO2JSON
A Vite plugin that compiles GNU gettext PO files into JSON translation dictionaries for App Suite UI. Forked from @open-xchange/rollup-plugin-po2json and adapted for Vite 8 / Rolldown.
Install
pnpm i "@open-xchange/vite-plugin-po2json"How to use
// in the vite.config.js
import vitePluginPo2json from '@open-xchange/vite-plugin-po2json'
export default defineConfig({
plugins: [vitePluginPo2json({
poFiles: 'i18n/*.po'
})]
})Options
- poFiles
<string>(required) Glob pattern pointing to the PO files to compile. - outFile
<string>Output filename for the extracted POT file. Default:'i18n.pot' - defaultDictionary
<string>Name of the default translation dictionary. Default:'i18n' - defaultLanguage
<string>The default language to use. Default:'en_US' - headers
<object>Headers to include in the generated POT file. Default:{ 'Content-Type': 'text/plain; charset=UTF-8', 'Content-Transfer-Encoding': '8bit' } - includeFuzzy
<boolean>Whether to include fuzzy translations in the output. Default:false
How to test
pnpm test