GitHub - RakshithNM/depslo: A psuedolocalization tool

2 min read Original article ↗

Image representing depslo tool generated by dalle

Pseudo Localization Tool

Why?

Software that supports multiple languages is often designed first in English. Later translations can be longer or shorter than the source text, and that can break layouts or leave too much empty space.

depslo helps catch these issues early by pseudo-localizing English strings into readable transformed text with realistic length changes.

What is possible today?

  • API endpoints to pseudo-localize JSON string maps.
  • CLI utility to pseudo-localize an entire JSON file.

API routes

The server listens on localhost:1234 and currently exposes these routes:

  1. POST /translate

    • Purpose: basic pseudo localization using default behavior.
    • Request body:
    {
      "HELLO": "Hello, this is Rakshith",
      "TITLE": "The coolest developer tool"
    }
    • Example:
    curl http://localhost:1234/translate \
      --include \
      --header "Content-Type: application/json" \
      --data '{"HELLO":"Hello, this is Rakshith","TITLE":"The coolest developer tool"}'
  2. POST /localize

    • Purpose: advanced pseudo localization with language and content type tuning.
    • Request body:
    {
      "strings": {
        "HELLO": "Hello, this is Rakshith",
        "TITLE": "The coolest developer tool"
      },
      "language": "es",
      "content_type": "ui"
    }
    • language supports: es, de, fr, zh (default: es)
    • content_type supports: ui, technical, marketing, legal (default: ui)
    • Example:
    curl http://localhost:1234/localize \
      --include \
      --header "Content-Type: application/json" \
      --data '{"strings":{"HELLO":"Hello, this is Rakshith","TITLE":"The coolest developer tool"},"language":"es","content_type":"ui"}'

To try the server

  1. Clone the repo and navigate to the depslo directory.
  2. Run ./scripts/serve.sh.
  3. Call either POST /translate or POST /localize using the examples above.

To try the CLI

  1. Clone the repo and navigate to the depslo directory.
  2. Run:
    cd cmd
    go run depslo.go ../test/cli/test.json
  3. The command outputs: The psuedo local converted JSON file is at depslo.json
  4. Open cmd/depslo.json to inspect the pseudo-localized content.