Skip to content

Console helper for managing i18n labels using the sf-cms endpoints.

Notifications You must be signed in to change notification settings

prepair/sf-label-manager

Repository files navigation

SF label manager

SF locale tools. Authentication not required.

setup

Env vars (dotenv file supported):

  • TIMEOUT: timeout for request, in millisec, default is 300000 (5 minutes!)
  • API: sf cms dev url (or urls, separated with comma) with api part (something like https://cms.env.webdev.local/api)
  • PACKAGE: for the get everything and daily backup scripts: cms package (Prepair, Foobar, Bazqux etc.)
  • RESOURCES: for the get everything and daily backup scripts: comma separated list of lang resources

Example:

TIMEOUT=10000
API=https://cms.uat.webdev.local/api,https://cms.dev-actual.webdev.local/api,https://cms.dev-next.webdev.local/api,https://cms.dev-prod.webdev.local/api,https://cms.test.webdev.local/api
PACKAGE=Prepair
RESOURCES=PrepairUserFinderResources,PrepairUserStatusResources,PrepairErrorCodeResources,DoNotTranslateResources

If you are using multiple api urls (like in the example) then the get operations (get, get-all) will use the first url from the list.

npm scripts

get

npm run get - download one specific label for a given language.

  • see output for command line options
  • use "--" with npm (https://docs.npmjs.com/cli/run-script)
  • saves the result to output.json
  • example: npm run get -- Invariant FooBarResources qux-title

Output example:

{
  "ClassId": "FooBarResources",
  "Items": {
    "qux-title": {
      "Description": "Description for the FooBarResources resources class",
      "Value": {
        "Invariant": "The Qux is 42"
      }
    }
  }
}

post

npm run post - uploads the ./upload.json file.

  • try to combine the labels into one big item (./examples/upload-bfc-season-combined)
  • if you want to upload into different groups then the uploader will do it in parallel requests. This MAY KILL the cms api.

delete

npm run delete - use the ./delete.json file.

  • read label keys from delete.json and try to delete all labels

get-everything

npm run get-everything - download all defined groups.

  • get all "en-gb" groups
  • json files are saved in the output folder

daily-backup

npm run daily-backup - download all the groups and all the languages

  • by default saves all languages AND all groups in the daily folder
  • use cron or run it manually

About

Console helper for managing i18n labels using the sf-cms endpoints.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published