Skip to content

Commit

Permalink
Backport.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Mar 5, 2024
1 parent 7755a85 commit 87e4991
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
35 changes: 35 additions & 0 deletions src/main/java/org/meeuw/i18n/languages/LanguageCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,36 @@ default String getCode() {
String part1();

Scope scope();

@Deprecated
default Scope getScope() {
return scope();
}

Type languageType();



@Deprecated
default Type getLanguageType() {
return languageType();
}

String refName();

@Deprecated
default String getRefName() {
return refName();
}

String comment();


@Deprecated
default String getComment() {
return comment();
}

/**
* @since 2.2
*/
Expand All @@ -222,6 +245,18 @@ default NameRecord nameRecord(Locale locale) {
throw new UnsupportedOperationException();
}
}

@Deprecated
default String getName() {
return nameRecord(Locale.US).print();
}


@Deprecated
default String getInvertedName() {
return nameRecord(Locale.US).inverted();
}


/**
* The macro language(s) of which this language is a part.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
import org.meeuw.i18n.languages.ISO_639;
import org.meeuw.i18n.languages.LanguageCode;

@SuppressWarnings("OptionalGetWithoutIsPresent")
Expand Down Expand Up @@ -55,14 +56,14 @@ public void getByPart1() {
}
@Test
public void getByPart2T() {
assertThat(LanguageCode.getByPart2T("nld").get().getRefName()).isEqualTo("Dutch");
assertThat(LanguageCode.getByPart2T(null)).isEmpty();
assertThat(ISO_639.getByPart2T("nld").get().getRefName()).isEqualTo("Dutch");
assertThat(ISO_639.getByPart2T(null)).isEmpty();
}

@Test
public void getByPart2B() {
assertThat(LanguageCode.getByPart2B("dut").get().getRefName()).isEqualTo("Dutch");
assertThat(LanguageCode.getByPart2B(null)).isEmpty();
assertThat(ISO_639.getByPart2B("dut").get().getRefName()).isEqualTo("Dutch");
assertThat(ISO_639.getByPart2B(null)).isEmpty();
}

@Test
Expand Down

0 comments on commit 87e4991

Please sign in to comment.