slang 3.25.0 slang: ^3.25.0 copied to clipboard
Localization / Internationalization (i18n) solution. Use JSON, YAML or CSV files to create typesafe translations via source generation.
3.25.0 #
- feat: add
dart run slang clean
to remove unused translations after runningslang analyze
(#141) - feat: add
--exit-if-changed
toslang analyze
to fail CI if there are missing / unused translations (#141) - fix: code generator should not crash if context is not included in i18n (#165)
- fix: should not generate
contextBuilder
andnBuilder
parameter in rich text if not needed (#168)
3.24.0 #
- feat:
slang edit add
respects order in base locale (@adil192) - feat:
slang edit add
works without a specified locale, it will add the string to all locales - feat: use
WidgetsBinding.instance.platformDispatcher
instead ofPlatformDispatcher.instance
infindDeviceLocale
implementation - fix: correctly obfuscate line breaks and single quotes
3.23.0 #
- feat: support multiple
TranslationProvider
at the same time when using multiple packages - fix: trailing slash in config does not work with
build_runner
- i18n: Swedish plural resolver improvement (by @lohnn)
3.21.0 #
- feat: add input directory as comment to generated files
- fix: migrate away from deprecated
WidgetsBinding.instance.window
infindDeviceLocale
implementation - fix: handle empty maps in
_missing_translations
in yaml format (by @adil192)
3.19.0 #
- feat: add enum value inference (no need to specify
enum
in the config anymore) - feat: add
slang edit copy
to copy translations - feat: namespaces may contain underscores if at least one file of same directory uses locale from directory name
- DEPRECATED: Use explicit
context
modifier instead of relying on the config file (see migration guide)
3.18.1 #
- chore: add logo
3.18.0 #
- feat: add
slang edit
tomove
ordelete
translations over all locales - fix: avoid infinite loop of symlinks
3.17.0 #
- fix: setLocale does not work when Locale enum is from two packages (by @fzyzcjy)
- fix:
slang outdated
should skip missing translations instead of throwing an error
3.16.2 #
- fix: handle dynamic keys when
fallback_strategy: base_locale
is used
3.16.1 #
- fix: handle interpolation when obfuscation is enabled
3.16.0 #
- feat: add
obfuscation
config to obfuscate translation strings
3.15.1 #
- fix:
slang analyze
with--full
should find invocations written in multiple lines
3.15.0 #
- feat: add
OUTDATED
modifier to flag translations as outdated (slang analyze
will treat them as missing) - feat: run
flutter pub run slang outdated my.key.path
to flag translations as outdated - feat:
slang apply
prefers modifiers from base locale over secondary locales
3.14.0 #
- feat:
LocaleSettings.useDeviceLocale
listens to device locale changes - feat:
flutter pub run slang apply
only applies changed locales by default - fix: locale selection with script code (e.g.
zh-Hant-TW
useszh-TW
instead ofzh-HK
)
3.13.0 #
- feat: generated files from
analyze
andapply
have\n
at the end of the file
3.12.0 #
- feat: mixins generated by the interface feature now have
==
andhashCode
overrides - feat:
flutter pub run slang apply
now respects the order in the base locale instead of simply add the new translations to the end - feat:
flutter pub run slang analyze
now have--split-missing
and--split-unused
(in addition to--split
) so only one of both can be a single file
3.11.1 #
- fix: missing unused translations in secondary locales
3.11.0 #
- feat: add
(ignoreMissing)
and(ignoreUnused)
modifiers which changes the behaviour offlutter pub run slang analyze
3.10.0 #
- feat: there is now a default plural resolver so the app keeps working in production when you forgot to define one, you will only see a warning in the log
- fix:
key_map_case
should work with(map)
modifier
3.9.0 #
- feat: improve interface attribute inference algorithm
- feat: generate to
lib/gen/<filename>
in Flutter environment by default if input is outside oflib/
and no output directory is given
3.8.0 #
- feat: add
(interface=<Interface>)
and(singleInterface=<Interface>)
modifiers, a new approach to configure interfaces without touching the config file - feat: add
AppLocaleUtils.supportedLocales
andAppLocaleUtils.supportedLocalesRaw
, this API works inlocale_handling: false
- fix: possible class name conflict for objects inside lists
- DEPRECATED:
LocaleSettings.supportedLocales
andLocaleSettings.supportedLocalesRaw
3.7.0 #
- feat: official web support
3.6.0 #
- feat: RichText supports links inside default translation
- feat:
flutter pub run slang watch
works recursively and does not crash on error
3.5.0 #
- feat: csv decoding now support both
CRLF
andLF
,"
and'
- fix:
LocaleSettings.setPluralResolver
should not throw an assertion error - fix:
flutter pub run slang migrate
should also work without:
in command
3.4.0 #
- feat: add
--locale=<locale>
argument toflutter pub run slang apply
to only apply a specific locale - BREAKING (TOOL):
--flat
argument forflutter pub run slang analyze
andapply
is no longer available
3.3.1 #
- fix: when namespaces are used, consider more directories (not only parent) for locale detection (e.g.
assets/i18n/en-US/pages/home.json
)
3.3.0 #
- feat:
flutter pub run slang analyze
now also checks unused translations (on top of missing translations) - docs: prefer
slang analyze
overslang:analyze
(and for all other commands); both styles are supported however
3.2.0 #
- feat: add command
flutter pub run slang:apply
to add translations from theslang:analyze
result - fix: handle
isFlatMap
parameter when overriding translations correctly - fix: update arb migration tool to respect new modifier syntax
3.1.0 #
- feat: add command
flutter pub run slang:analyze
to report missing translations
3.0.0 #
Translation Overrides and Enhanced Modifiers
- feat: it is now possible to override translations via
LocaleSettings.overrideTranslations
(checkout updated README) - feat: there is a new modifier syntax which allows for multiple modifiers e.g.
myKey(plural, rich)
- feat: improve file scan (now only checks top-level directory for any config files)
- Breaking: default plural parameter is now
n
; you can revert this by settingpluralization
/default_parameter: count
- Breaking: custom plural/context parameter must follow syntax
apples(param=appleCount)
All breaking changes will result in a compile-time error, so don't worry for "hidden" bugs :)
You can read the detailed migration guide here.
2.8.0 #
- feat: add
AppLocaleUtils.parseLocaleParts
- fix:
LocaleSettings.useDeviceLocale
now does not complain of weird locales on Linux - fix: rich text now handles all characters
- fix: rich text properly applies param_case
- fix: empty nodes are rendered as classes instead of claiming them as plurals
2.7.0 #
- feat: ignore empty plural / context nodes when
fallback_strategy: base_locale
is used - feat: add
coverage:ignore-file
to generated file and ignore every lint
2.6.2 #
- feat: add Russian plural resolver (thanks to @LuckyWins)
- fix: parse rich text with interpolation
braces
anddouble_braces
correctly
2.6.1 #
- fix: remove
const
if rich text has links
2.6.0 #
- feat: render context enum values as is, instead of forcing to camel case
- feat: add additional lint ignores to generated file
- fix: generate correct ordinal (plural) call
- fix: handle rich texts containing linked translations
2.5.0 #
- feat: add extension method shorthand (e.g.
context.tr.someKey.anotherKey
) - feat: add
LocaleSettings.getLocaleStream
to keep track of every locale change - feat: return more specific
TextSpan
instead ofInlineSpan
for rich texts
2.4.1 #
- fix: do not export
package:flutter/widgets.dart
2.4.0 #
- feat: allow external enums for context feature (add
generate_enum
andimports
config) - feat: add default context parameter name (
default_parameter
) - feat: add export statement in generated file to avoid imports of extension methods
2.3.1 #
- fix: add missing fallback for flat map if configured
2.3.0 #
- feat: use tight version for
slang_flutter
andslang_build_runner
- fix: throw error if base locale not found
- fix:
TranslationProvider
should use current locale - fix: use more strict locale regex to avoid false-positives when detecting locale of directory name
2.2.0 #
- feat: locale can be moved from file name to directory name (e.g.
i18n/fr/page1_fr.i18n.json
toi18n/fr/page1.i18n.json
)
2.1.0 #
- feat: add
slang.yaml
support which has less boilerplate thanbuild.yaml
- fix: move internal
build.yaml
to correct package
2.0.0 #
Transition to a federated package structure
- Breaking: rebranding to
slang
- Breaking: add
slang_build_runner
,slang_flutter
depending on your use case - Breaking: remove
output_file_pattern
(was deprecated) - feat: dart-only support (
flutter_integration: false
) - feat: multiple package support
- feat: RichText support
Thanks to @fzyzcjy.
You can read the detailed migration guide here.