Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@allboatsrise/gatsby-transformer-po

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@allboatsrise/gatsby-transformer-po

Gatsby transformer plugin for PO files

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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:

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `data`,
        path: `${__dirname}/src/intl/`,
      },
    },
    {
      resolve: '@allboatsrise/gatsby-transformer-po',
      options: {
        // Possible values:
        //   1. `({node: GatsbyApiNode, object: PO}) => string` - callback called for each file expecting locale string to be returned
        //   2. fixed string (e.g 'en-us') 
        //   3. Dynamically determined from filename: en_US.po => 'en-us' (default)
        locale: undefined,

        // when true, msgstr is set to first string, otherwise this will be an array of strings
        forceSingleMsgStr: undefined,

        // used when creating node to define type (default: 'Po')
        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

FAQs

Package last updated on 06 Aug 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc