gatsby-source-transifex

1.0.0 • Public • Published

gatsby-source-transifex

Install

npm install --save gatsby-source-transifex

How to use

First, you need a way to pass environment variables to the build process, so secrets and other secured data aren't committed to source control. We recommend using [dotenv][dotenv] which will then expose environment variables. [Read more about dotenv and using environment variables here][envvars]. Then we can use these environment variables and configure our plugin.

Using Delivery API

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-transifex`,
      options: {
        organization: `your_organization`,
        project: `your_project`,
        source_lang_code: `en`, // default lang
        locales: [`de`,`sv`], // array of all translated lang
        auth: `${process.env.TRANSIFEX_USER}:${process.env.TRANSIFEX_TOKEN}`,
      },
    },
  ],
}

Query for all nodes

You might query for all of resources:

{
  allTransifexTranslationField {
    nodes {
      id
    }
  }
  allTransifexResourceField {
    nodes {
      id
    }
  }
}

Translation as JSON

{
  transifexTranslationField(id: {eq: "transifex-{insert-your-resource-id}-{insert-locale}"}) {
    id
    json
  }
}

Resource as JSON

{
  transifexResourceField(id: {eq: "transifex-{insert-your-resource-id}"}) {
    id
    json
  }
}

All Translations from locale

{
  allTransifexTranslationField(filter: { node_locale: { eq: "de" } }) {
    nodes {
      id
    }
  }
}

Package Sidebar

Install

npm i gatsby-source-transifex

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

14.3 kB

Total Files

12

Last publish

Collaborators

  • mikael.kristiansson