Skip to content

Commit

Permalink
#27448 Removing the language label as can also be calculated from the…
Browse files Browse the repository at this point in the history
… ISO code
  • Loading branch information
jgambarios committed Apr 10, 2024
1 parent 43edc62 commit 80fc192
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ default String dotCMSObjectType() {
@JsonView({LanguageReadView.class, LanguageWriteView.class})
Optional<String> countryCode();

@JsonView({LanguageFileView.class, LanguageReadView.class, LanguageWriteView.class})
@JsonView({LanguageReadView.class, LanguageWriteView.class})
Optional<String> language();

@JsonView({LanguageReadView.class, LanguageWriteView.class})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public String fileName(final Language language) {
public String shortFormat(final Language language, final PullOptions pullOptions) {

return String.format(
"language: [@|bold,underline,blue %s|@] "
+ "isoCode: [@|bold,yellow %s|@]",
language.language().orElse(""),
"isoCode: [@|bold,yellow %s|@]",
language.isoCode()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.dotcms.model.language.Language;
import java.io.File;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;
import javax.enterprise.context.Dependent;
Expand Down Expand Up @@ -86,9 +85,7 @@ private boolean equals(@Nullable Language toCompare, @Nullable Language another)
return false;
}

return Objects.equals(
toCompare.language().orElse(""), another.language().orElse("")
) && toCompare.isoCode().equalsIgnoreCase(another.isoCode());
return toCompare.isoCode().equalsIgnoreCase(another.isoCode());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ private Language setMissingValues(Language localLanguage,
matchingServerLanguage.get().defaultLanguage());
}

if (localLanguage.language().isEmpty() && matchingServerLanguage.isPresent()) {
localLanguage = localLanguage.withLanguage(matchingServerLanguage.get().language());
}

final String isoCode = localLanguage.isoCode();
if (localLanguage.languageCode().isEmpty()) {
localLanguage = localLanguage.withLanguageCode(isoCode.split("-")[0]);
Expand Down

0 comments on commit 80fc192

Please sign in to comment.