-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for an --exclude-langs
option for file download
#129
Comments
For instance when you put |
@christianYoopies But let's keep the discussion here about the support for a new |
While the feature to exclude languages directly with an PrerequisitesBefore using the script, ensure that
Script OverviewThe script operates in a few key steps:
The Script#!/bin/bash
# Configuration: Replace with your project's ID and Lokalise API token.
PROJECT_ID="your_lokalise_project_id_here"
LOKALISE_TOKEN="your_lokalise_token_here"
EXCLUDE_LANGS="en,fr"
# Convert the excluded languages into a jq filter format.
EXCLUDE_FILTER=$(echo $EXCLUDE_LANGS | awk -F, '{for(i=1; i<=NF; i++) print "\""$i"\"";}' | paste -sd "," -)
# Fetch the language list, excluding specified languages, and format the result as a comma-separated string.
FILTERED_LANGS=$(lokalise2 language list --project-id=$PROJECT_ID --token=$LOKALISE_TOKEN | jq -r --argjson exclude "[$EXCLUDE_FILTER]" '[.languages[].lang_iso | select(. as $lang | $exclude | index($lang) | not)] | join(",")')
# Use the filtered languages in the download command.
lokalise2 file download --project-id=$PROJECT_ID --token=$LOKALISE_TOKEN --filter-langs="$FILTERED_LANGS" --format=json How It Works
Usage
This script should save you time and reduce the manual effort of updating your CI scripts whenever you add new languages to your Lokalise project. It effectively simulates an |
@yarlson good idea, thanks! |
@yarlson such logic couldn't be implemented directly inside the CLI to add the support for the new option? 😁 |
would be really helpful to have this option, as in my situation I would like to download only the languages I don't maintain myself, for example English and French.
so I'd use it as
--exclude-langs=en,fr
.as of now, I have to update the command on my CI each time I add a new language.
The text was updated successfully, but these errors were encountered: