Skip to content

fix: disabled target languages warning#1008

Open
katerina20 wants to merge 1 commit intomainfrom
fix/target-lang-warn
Open

fix: disabled target languages warning#1008
katerina20 wants to merge 1 commit intomainfrom
fix/target-lang-warn

Conversation

@katerina20
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 0% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.11%. Comparing base (9243204) to head (517f8d4).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
...cli/commands/actions/UploadTranslationsAction.java 0.00% 22 Missing ⚠️
src/main/java/com/crowdin/cli/client/Client.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1008      +/-   ##
============================================
- Coverage     65.26%   65.11%   -0.14%     
- Complexity     1679     1773      +94     
============================================
  Files           244      255      +11     
  Lines          6887     7339     +452     
  Branches       1047     1110      +63     
============================================
+ Hits           4494     4778     +284     
- Misses         1795     1917     +122     
- Partials        598      644      +46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +118 to +121
if (e instanceof ResponseException) {
ConsoleSpinner.stop(WARNING);
throw (ResponseException) e;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a risk of getting another ResponseException and treating it as a warning? We have a bunch of response exceptions that should be treated as errors

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts translation upload behavior so that when a translation file can’t be imported because its target language isn’t enabled for the source file in Crowdin, the CLI prints a warning instead of failing with an error.

Changes:

  • Added a new user-facing warning message for “translation not uploaded because target language isn’t enabled”.
  • Updated Client.executeAsyncActionWithoutSpinner to propagate ResponseException (so callers can handle WrongLanguageException explicitly).
  • Handled WrongLanguageException in UploadTranslationsAction to print a warning and skip the failing import.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/main/resources/messages/messages.properties Adds a new localized warning message used when import is blocked by disabled target languages.
src/main/java/com/crowdin/cli/commands/actions/UploadTranslationsAction.java Catches WrongLanguageException during translation import and prints a warning instead of failing.
src/main/java/com/crowdin/cli/client/Client.java Updates async execution helper to rethrow ResponseException and stop the spinner with WARNING status for those cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.


message.warning.not_yml=File '%s' is not a YAML or YML file
message.warning.browser_not_found=\nError opening a web browser. Please open the following link manually:\n%s
message.warning.file_not_uploaded_cause_of_language=Translation file @|yellow '%s' hasn't been uploaded|@ since %s is not enabled as a target language for the source file in your Crowdin project
}

static <S> S executeAsyncActionWithoutSpinner(
static <S> S executeAsyncActionWithoutSpinner (
Comment on lines +170 to +174
} catch (WrongLanguageException e) {
String languageNames = langs.stream()
.map(Language::getName)
.collect(Collectors.joining("/"));
out.println(WARNING.withIcon(String.format(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants