iso_languages 1.1.0
iso_languages: ^1.1.0 copied to clipboard
A Flutter package to work with ISO 639-1 language codes, providing language names, native names, and utility functions.
1.1.0 #
New Features #
- Added support for more ISO 639-1 language codes, expanding language coverage.
- Improved functionality to handle edge cases with invalid or unknown ISO codes. Now returns a more informative error message when an unknown code is provided.
Bug Fixes #
- Fixed issue where retrieving native language names sometimes returned incorrect results.
Improvements #
- Enhanced documentation: Added detailed examples and better explanations in the README and Dartdoc comments.
- Optimized code for better performance when retrieving language names.
Example usage: #
import 'package:iso_languages/iso_languages.dart';
void main() {
// Get the English name of the language
String englishName = isoLanguage(shortName: 'en');
print('English Name: $englishName'); // Output: English
// Get the native name of the language
String nativeName = isoLanguage(shortName: 'ab', isNativeName: true);
print('Native Name: $nativeName'); // Output: аҧсуа бызшәа
// Get the Full name of the language
String name = isoLanguage(shortName: 'bn');
print('Full Name: $name'); // Output: Bangla
// Get the native name of the language
String nativeName = isoLanguage(shortName: 'bn', isNativeName: true);
print('Native Name: $nativeName'); // Output: বাংলা
// Handle unknown codes gracefully
String unknown = isoLanguage(shortName: 'unknown');
print('Unknown Code: $unknown'); // Output: (Empty String)
}
Usage in a Flutter Text Widget:
Text(
isoLanguage(shortName: 'en'),
style: TextStyle(
fontSize: 16,
),
);