gatsby-transformer-po
Gatsby transformer plugin for PO files.
Install
npm install --save @allboatsrise/gatsby-transformer-po
Note: You generally will use this plugin together with the gatsby-source-filesystem plugin. gatsby-source-filesystem reads in the files then this plugin transforms the files into data you can query.
How to use
If you put your .po
files in ./src/intl
:
module.exports = {
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `data`,
path: `${__dirname}/src/intl/`,
},
},
{
resolve: '@allboatsrise/gatsby-transformer-po',
options: {
locale: undefined,
forceSingleMsgStr: undefined,
typeName: undefined,
}
}
]
}
How to query
You'd be able to query your translations like:
{
allPo {
edges {
node {
msgid
locale
msgstr
namespace
}
}
}
}
Plugin Development
npm run watch
- run in background while developing in order to automatically build code when files modified
npm run build
- run once to build the code
npm run clean
- removes built files