@makemepulse/tool-i18n

Handle locales with Google Spreadsheet and vue-i18n plugin
5,419
Install
npm install @makemepulse/tool-i18n@next
Latest Version:0.2.1
License:ISC
Last Updated:Jun 12, 2025
Links: GitHub  ·  npm
Maintainer: makemepulse

makemepulse tool i18n

Handle localisation with a templated Google Spreadsheet

Table of content

Requirements / Prerequisite

  • A Vue.js project:
    • vue
    • vue-i18n
  • A Google Sheets from the template Template_tool_i18n:
    1. New Google Sheets from a template
    2. Choose Template_tool_i18n tempate
    3. Add/Remove/Update languages the project need to support
    4. The spreadsheet must be public! Go to File > Share > Publish to the web to make it public.
    5. Copy the ID starting with 2PACX- inside the public link.
    6. That'it!

Installation

npm install @makemepulse/tool-i18n --save-dev

Options

CLI argument Env variable Type Description Default
--spreadsheet-id I18N_SPREADSHEET_ID string The ID of the spreadsheet. To avoid 401 errors, use the public one starting with 2PACX- ""
--spreadsheet-tab I18N_SPREADSHEET_TAB string The tab of the spreadsheet "locales"
--ignore-fields I18N_IGNORE_FIELDS string Comma-separated list of fields that are not locales "ID,category,key,description,status"
--only-fields I18N_ONLY_FIELDS string Comma-separated list of fields to target only these locales ""
--locales-dir I18N_LOCALES_DIR string The path of the locales folder "src/locales"
--filename I18N_FILENAME string The pattern to use for naming exported JSON for each locale.
Forward slashes / can be used to place files in sub-directories.
Available placeholders:
- [locale]: The locale name
"[locale]"
--prettify - boolean Format the JSON output false
--flatten - boolean Flatten nested keys into one in the JSON output false

Settings

.env file

Eg: Define the I18N_SPREADSHEET_ID from the current spreadsheet url: https://docs.google.com/spreadsheets/d/1bH-aZzj38YjIZTlWhv1XKWc9NyItRAuRXnQEZoWRmzA/edit#gid=0

I18N_SPREADSHEET_ID = '1bH-aZzj38YjIZTlWhv1XKWc9NyItRAuRXnQEZoWRmzA'
I18N_LOCALES_DIR = src/locales

Commands

Command Description Arg
i18n Fetch the spreadsheet and create vue-i18n locale json files. see Options
i18n:up up sync will create __i18n_sync.xlsx at the root of the project see Options

Add the following commands to your package.json file:

{
    "scripts": {
        "i18n": "node ./node_modules/mmp-tool-i18n/lib/index.js --spreadsheet-id=__YOUR_I18N_SPREADSHEET_ID__",
        "i18n:up": "node ./node_modules/mmp-tool-i18n/lib/upsync.js --spreadsheet-id=__YOUR_I18N_SPREADSHEET_ID__"
    }
}

Troubleshootings

Arabic language

Please note that if your project needs arabic locales and if there is Latin character in your arabic locales, you must the v-html directive to display the locales

Test

npm test

Related Packages

@vintl/vintl

Integrate @formatjs/intl into your Vue apps for easier internationalisation

10,663 5
vite-plugin-vue-viai18n

i18n transform plugin for vite/vue which can generate message key automatically

2,940 0
vue-i18n-loader

Another i18n solution for Vue (Nuxt) with auto generated keys

2,477 0
viai18n-loader

Another i18n solution for Vue (Nuxt) with auto generated keys

1,750 3

Version History

Version Released License
0.2.1 ISC
0.2.0 ISC
0.1.3 ISC
0.1.2 ISC
0.1.1 ISC