Skip to content

Symfony plural form is not recognized when upload #201

@patckin-d

Description

@patckin-d

Hello! I tried to make a script to upload translations from code into Lokalise. I faced issue when I try to upload plural key in Symphony format.
I try to upload key { "plural_gitlab": "p4|p44" }
And I got

Image

But I expected to have:

Image

In project settings I set JSON import format to Classic

Image

My script:

#!/bin/bash
set -euo pipefail

: "${LOKALISE_API_TOKEN:?Need to set LOKALISE_API_TOKEN}"
: "${LOKALISE_PROJECT_ID:?Need to set LOKALISE_PROJECT_ID}"

BIN_DIR="./bin"
LOKALISE_CLI="$BIN_DIR/lokalise2"
BRANCH_TAG="gitlab-integration-test"

if [[ ! -x "$LOKALISE_CLI" ]]; then
  echo "❌ Lokalise CLI not found $LOKALISE_CLI"
  exit 1
fi

if [[ ! -d "locales/en" ]]; then
  echo "❌ Directory 'locales/en' not found!"
  exit 1
fi

echo "🚀 Uploading from locales/en/..."
echo "📛 Using tag: $BRANCH_TAG"

find locales/en -name '*.json' | xargs -P 6 -I{} env FILE="{}" BRANCH_TAG="$BRANCH_TAG" bash -c '
  echo "📤 Uploading $FILE..."
  '"$LOKALISE_CLI"' \
    --token='"$LOKALISE_API_TOKEN"' \
    --project-id='"$LOKALISE_PROJECT_ID"' \
    file upload \
    --file="$FILE" \
    --lang-iso="en" \
    --convert-placeholders='false' \
    --detect-icu-plurals='true' \
    --include-path \
    --replace-modified \
    --poll \
    --tag-inserted-keys \
    --tags="gitlab,$BRANCH_TAG"
  echo "✅ Uploaded: $FILE"

'

echo "🎉 All files uploaded."

I didn't find a flag to set plural format on upload, may be I need to configure anything in my project that I have no permission? Please, help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions