sealed_languages 0.2.0 copy "sealed_languages: ^0.2.0" to clipboard
sealed_languages: ^0.2.0 copied to clipboard

Provides data for world languages in the form of sealed classes.

example/main.dart

// ignore_for_file: avoid_print

import "package:sealed_languages/sealed_languages.dart";

void main() {
  final indoEuropeanLanguages = NaturalLanguage.list.where(
    (language) => language.family is IndoEuropean,
  );
  // Prints a list of Indo-European languages:
  print(indoEuropeanLanguages);
  // (Language(name: Avestan), Language(name: Afrikaans),
  // ...
  // Language(name: Walloon), Language(name: Yiddish).

  final english = NaturalLanguage.fromCode("Eng");
  print("${english.name}: ${english.codeShort}"); // Prints: "English: EN".

  final russian = NaturalLanguage.fromCodeShort("ru");
  print("${russian.name}: ${russian.code}"); // Prints: "Russian: RUS".

  final maybeCzech = NaturalLanguage.maybeFromValue(
    "CZE",
    where: (language) => language.bibliographicCode,
  );

  // This will print: "Native name: čeština".
  print("Native name: ${maybeCzech?.namesNative.first}");

  print(NaturalLanguage.list.length); // Prints: "184".
}
9
likes
0
pub points
79%
popularity

Publisher

verified publishertsin.is

Provides data for world languages in the form of sealed classes.

Repository (GitHub)
View/report issues

Topics

#languages #language #locale #sealed #iso-639 #iso

License

unknown (license)

More

Packages that depend on sealed_languages