sealed_languages 1.5.1 sealed_languages: ^1.5.1 copied to clipboard
Provides data for world languages in the form of sealed classes.
1.5.1 #
NEW FEATURES
- Added "polski" to the Polish language
namesNative
array. - Improvements of
toString()
method implementations in models and addressing new lints + DCM reports.
1.5.0 #
This is the last minor version update with significant changes for some time. The next steps will be patches at most. Currently working on
sealed_countries
(andworld_countries
) v2.0.0 which will bring new data and a big feature there, very likely without breaking the existing API.
NEW FEATURES
- 🎉 All translations in the eco-system packages now support all GlobalMaterialLocalizations and GlobalCupertinoLocalizations locales.
- The
locale
parameter in themaybeTranslation
method is now nullable. - The
permissive
constructors are now even more permissive, onlyname
andcode
parameters remain required.
1.4.0 #
NEW FEATURES
- 🦾 Language translations now support all
GlobalMaterialLocalization
+GlobalCupertinoLocalizations
locales. - Added new
internationalName
getter inIsoStandardized
interface, representing the international name of the ISO object. - Added new
UpperCaseMap
class, thatUpperCaseIsoMap
extends, a simple version ofUpperCaseIsoMap
without key length checks andIsoStandardized
values requirement. - Added new
BasicLocale
class, thatTranslatedName
extends. Representing a type-safe world locale (language, country/region code and script). - Added new
commonNamesCacheMap
method for all ISO based sealed classes collections, which allows to create a cache map of common names translations for the givenBasicLocale
.
BREAKING CHANGES
Because of the BasicLocale
changes (described above), translation()
and maybeTranslation()
methods on the Translated
classes now require BasicLocale
input. If you are not using those methods directly, then you don't need to change anything, otherwise you will need to do small adjustment - wrap the content of those methods with a BasicLocale
.
Before:
print(iso?.maybeTranslation(LangPor()));
After:
print(iso?.maybeTranslation(BasicLocale(LangPor())));
Or just:
- Enable Regular Expressions in your IDE's Find and Replace panel.
- In the Find field, enter the regex:
(translation\()(.*)(\))
- In the Replace field, enter:
$1BasicLocale($2)$3
- Execute the replace operation.
1.3.1 #
REFACTOR
- Refactored asserts in
maybeMapIsoCode
method. - Fixed typos in CHANGELOG and README.
1.3.0 #
NEW FEATURES
codeOther
is no longer nullable (in allIsoStandardized
classes).- Added new compile time constant and case-insensitive code maps (
UpperCaseIsoMap
s) in every ISO class (accessible as static constants via.map
,.codeMap
,.codeShort
etc.). - Factory constructors and methods now using those maps if no (optional) array is provided there.
- Factory constructors and methods in
IsoStandardized
classes now allow non-String inputs - anyObject
, for example you can now useStringBuffer
orEnum
instances directly:
enum IsoEnum {de, fr, ar} // On .fromCode(IsoEnum.de) call it will use "DE" input.
or you can basically use any custom class with toString()
override:
class CustomIsoCodeClass {
const CustomIsoCodeClass({String code = '123', this.foo}) : _code = code;
final String _code;
final Foo? foo;
@override
String toString() => _code; // Has to override toString() with ISO value.
}
// On .fromAnyCode(CustomIsoCodeClass(code: ' 321 ')) call it will use "321" input.
1.2.0 #
NEW FEATURES
- Added new static
maybeFrom*
methods and refactored old ones. They are also now accept anyObject?
input instead of justString?
. - Added new and refactored old tests with a performance in mind.
- Added new
firstIsoWhere*
extensions on ISO iterables. - Added
is*
boolean getters for example:
if (isoObject.isFra) return _onFrench();
is more readable and shorter equivalent of this check:
if (isoObject == const LangFra()) return _onFrench();
1.1.0 #
NEW FEATURES
- Added new constructor called
permissive
- which allow the creation of custom class instances that are not fully compatible with the ISO standard. Translated
class is now sealed - which means you can now directly compare instances of different ISO classes directly (for example in switch statements).
1.0.0 #
🎉 First anniversary and first stable release!
NEW FEATURES
- Added new getter for
TranslatedName
name calledcommon
, which might be useful in some cases whenname
is being used by a parent class. - Added a lot of translations from the Symfony.
- Updated LICENSE.
0.9.0 #
NEW FEATURES
- Added new interface
IsoTranslated
which combinesTranslated
andIsoStandardized
interfaces. - Added
standard*
static constants in ISO classes referencing different names of specific standards. - Improved documentation in README, added FAQ.
Note: Please make sure to replace deprecated methods with suggested replacements, because all of them will be removed in version 1.0.0.
0.8.0 #
NEW FEATURES
- Added new factories to
Script
andNaturalLanguage
-fromAnyCode
, which do the length and type checks and redirects to otherfromCode\*
constructors - Added new static methods to
Script
andNaturalLanguage
-maybeFromAnyCode
, which works same way asfromAnyCode
, but doesn't throwsStateErrors
if no ISO object is found. - Added
maybeMapIsoCode
method toString
extensions, which is used under the hood of(maybe)fromAnyCode
.
REFACTOR
-
Renamed
isIsoCode
toisIsoAlphaRegularCode
. -
Named classes now has boolean flag (
short
, defaults totrue
). -
TranslatedName
class by default returns.name
value ontoString()
. -
Refactored dollar symbols in
toString()
methods.
0.7.0 #
NEW FEATURES
- Added new sealed class -
Scripts
, comes from ISO 15924 standard. NaturalLanguage
class now contains info about scripts (writing systems) and translations of language name to other languages.- Added
translation
andmaybeTranslation
methods forTranslated
classes (i.e.NaturalLanguage
). - Refactored factory constructors for
IsoStandardized
classes - there is an optional parameter to provide custom list - Added
TranslatedName
class for translations. - Added new abstract interfaces:
Named
andTranslated
.
0.6.0 #
NEW FEATURES
- Added new interfaces (
IsoStandardized
,JsonEncodable
) and typedef (JsonMap
) to the model. - Added
copyWith
,toJson
, etc. to theNaturalLanguage
class. - Fixed the names native list for Sindhi in the data.
0.5.0 #
BREAKING CHANGES
NaturalLanguage.list
is now sorted alphabetically by the (3 letter)code
.
REFACTOR
- Factory constructors and static methods for data classes creation now implicitly trimming and comparing uppercase string inputs.
- Fixing old ignores and new linter rules.
- Updates in
dev_dependencies
.
0.2.2 #
REFACTOR
- Updates in
dev_dependencies
.
0.2.1 #
DOCUMENTATION
- Provided structure screenshot.
0.2.0 #
TEST
- Increase code coverage to 100%.
0.1.0 #
DOCUMENTATION
- Provided code coverage links and badge.
0.0.1 #
- Initial release.