- Initial release
- Move PluralRules to netstandard 2.1
- Fix .ftl tests treated by Git as binary
- Fix escaping
- Add 3rd party licenses
- Nit - remove annoying warning
- Fix row counting
- Fix error reports
- Make builds reproducible
- Fix issue with number formatting using
CultureInfo.CurrentCultureinstead ofCultureInfo.InvariantCulture. Big thanks to @Mailaender
- Linguini supports netstandard2.1 for use in Mono (this changes no API but introduces polyfills for netstandard2.1)
- Fix some stale dependencies
- Fix issue with
System.Text.Jsonleaking analyzers, causing issues on Mono - Minor tweak of versions of
System.Text.Jsonand enabling tests
- Fix issue with
System.Text.Jsoncausing problems with Mono see mono/mono#15833
Chatted with @danroth27 and he mentioned that this could be due to mono lagging in netstandard2.1 support. I can imagine that if they were missing a typeforward in netstandard.dll for IAsyncDisposable this could happen.
- Extracted
Linguini.Syntax.Serializersto a separate package - Changed the way
InsertBehaviorworks - Add support for net461 @mtkennerly
- Fixed error in
Linguini.Bundlethat prevented term and scope arguments from coexisting. @adcdefg30
- Adds
LinguiniBundle.HasAttrMessagemethod - Obsoletes
LinguiniBundle.TryGetAttrMsgforLinguiniBundle.TryGetAttrMessage - Obsoletes
LinguiniBundle.TryGetMsgforLinguiniBundle.TryGetMessage
- Changes default on
LinguiniBundle.SetIsolatingfromtruetofalse - Adds method
GetAttrMessage(string msgWithAttr, params (string, IFluentType)[] args)for ease of use. - Removes
enum InsertBehaviorin favor of three separate functions (TryAddFunction,AddFunctionOverriding,AddFunctionUnchecked) - Removes previously obsolete methods.
- Improves parsing performance by eliminating bounds check on
ReadOnlySpan<char>forchar@RoosterDragon Breaking changes:- ZeroCopyUtil
TryReadCharSpanreplaced withTryReadChar- Methods
IsIdentifier/IsNumberStart/IsAsciiDigit/IsAsciiUppercase/IsAsciiHexdigit/IsAsciiAlphabetictake char rather thanReadOnlySpan<char> EqualSpansmethod removed
- ZeroCopyReader
- method signature
ReadOnlySpan<char> PeekCharSpan(int offset = 0)changed tochar? PeekChar(int offset = 0) - method
SeekEoladded. - methods
TryPeekChar,TryPeekCharAt,CurrentChar, andIndexOfAnyCharadded.
- method signature
- ParserError
- factory method for
ExpectedTokensarguments changed
- factory method for
- LinguiniParser
- changed to use new ZeroCopyUtil internally. Non-breaking changes:
- Fluent bundle private bundle method separated into
AddEntryandAddEntryOverriding
- ZeroCopyUtil
- Fixes errors when reading line numbers due to interaction with ZeroCopy Parser (thanks to @PJB3005)
- Moves project to minimal dotnet version to 6
- Fixes errors when reading an empty line on Windows (reported by @JosefNemec)
- Experimental features when
UseExperimentalflag is true:-
Dynamic Reference - ability to reference terms/message using
$$term_ref. After defining it in file like so:# example.ftl cat = {$number -> *[one] Cat [other] Cats } dog = {$number -> *[one] Dog [other] Dogs } attack-log = { $$attacker(number: $atk_num) } attacked {$$defender(number: $def_num)}.
It can be called like following:
var args = new Dictionary<string, IFluentType> { ["attacker"] = (FluentReference)"cat", ["defender"] = (FluentReference)"dog", }; Assert.True(bundle.TryGetMessage("attack-log", args, out _, out var message)); Assert.AreEqual("Cat attacked Dog.", message);
-
Dynamic Reference attributes - You can call an attribute of a dynamic reference. It will be resolved at runtime, so make sure your term/message has the associated attribute. Example:
# dyn_attr.ftl -creature-elf = elf .StartsWith = vowel you-see = You see { $$object.StartsWith -> [vowel] an { $$object } *[consonant] a { $$object } }.
var args = new Dictionary<string, IFluentType> { ["object"] = (FluentReference)"creature-elf", }; Assert.True(bundle.TryGetMessage("you-see", args, out _, out var message)); Assert.AreEqual("You see an elf.", message);
-
Term passing - experimental feature allows users to override term arguments.
# ship_gender.ftl -ship = Ship .gender = { $style -> *[traditional] neuter [chicago] feminine } ship-gender = { -ship.gender(style: $style) -> *[masculine] He [feminine] She [neuter] It }
Usually when style isn't passed, it would to default
-ship.gender()i.e.neuter, which would setship-genderselector to neuter i.e.It. In above example if we set style variable tochicago,-ship.gender()it would evaluatefeminine, soship-genderwould would evaluate toShe.
-
-
Remove
net5or greater by -
Move to
net6and/ornet8. -
Move to
NUnit 4.0.1 -
Fix issue with Windows test not being fully run
-
[Breaking change]Refactor to use consistent naming -
Remove unnecessary
ContainsKey()calls and split dictionaries by @ElectroJr -
[Breaking change]MakeFluentBundleabstract and do some API refactoring- To fully resolve the issue reported by @ElectroJr a common base for bundle is added
FluentBundle. - Extract read-only methods to
IReadBundle - Adds
FrozenBundleas a read-only version ofFluentBundle - Most fields are read only.
- To fully resolve the issue reported by @ElectroJr a common base for bundle is added
-
[Major change]RefactorAst*API- Adds builder for most
Ast*types (AstMessage,AstTermandJunk). E.g.SelectExpressionBuilder(new VariableReference("x")) .AddVariant("one", new PatternBuilder("select 1")) .AddVariant("other", new PatternBuilder("select other")) .SetDefault(1) .Build();
- Adds
Equalsto mostLinguini.Syntax.Asttypes. - All serializers now have a
Readmethod implementation.
- Adds builder for most
- Add
AddResourceOverriding(Resource res).
TryGetMessagereturns error if no message was found.- Adds methods
FormatPatternErrRef,TryGetMessageErrRef,TryGetAttrMessageErrRef,TryGetMessageErrRefinIReadBundleand associated classes.
- Adds tracking of
AstLocationthrough parser. - Fixes some build warnings.
- Adds tracking for
AstLocationwhich tracks where the bundle came from.
- Obsoletes
LinguiniParserconstructor. IntroduceFromFile,FromFragment,FromTextReaderfactory method that deal withAstLocation. - Add
AstLocationto all IEntry descendants.
- Propagate
AstLocationthroughout bundle. - Obsoletes
AddResources(IEnumerable<string>)andAddResources(params string[])fromIResourceStep.
- Propagate changes in Serialization from adding
AstLocation.
- Moved generator to Lang version 12.
- Refactored CldrParser
class->struct. - Changed
ISourceGenerator->IIncrementalGenerator
- Adds docs to public API and ensure they are in the Nuget package.
- Fixes issue with
Functionsnot being properly passed to selectors for evaluation. (Thanks to @sowelipililimute)
- Removes
WriterHelpersandResolverHelper. This is backwards incompatible. But shouldn't have been used anyway. - Changes behavior of
FluentError.AsString()method - Changed behavior of
FluentBundlewhen encountering a laughing bomb attack. - Formatter functions that previously didn't work, now work for patterns, numbers and functions.
- Made
StepBuilderpublic and enabled for each step to return a corresponding interface viaGet{STEP_NAME}Builder.
- Adds
IEquatabletoAstTerm - Adds
AstMessageBuilder. - Adds
AstTermBuilder. - Adds implicit conversion from
stringtoIdentifierand back. - Adds
==and!=operators toIdentifierandNamedArgument.
- Publishes the changes erroenously made in commit 150698e72e3691704ee1fb0dfa3bb324743d6e86 as v0.10.0
- Yanks version v0.10.0
- Yanks version v0.10.0
- Fixes issue with non-literals allowed as named term arguments.
- Reintroduce
FormatPatternmethod fromIReadBundletoFluentBundle,FrozenBundle. - Add
IReadBundleinterface toConcurrentBundle(it implements it viaFluentBundle). - Change so
FormatPatternErrRefparameterref IList<FluentError>? errorsreturns null if no errors found.
- Replace
MaybeNullWhenwithNotNullWhen
- Deprecate
FormatPatternErrRef - Introduce
GetPatternUncheckedandTryGetPattern FormatPatternnow uses new method- Obsoletes
TryGetPattern(pattern, args, result, errors)forTryGetPattern(pattern, args, errors, result)inIReadBundleand implementors. GetPatternUncheckednow throwsFluentExceptionif no pattern found.- Removed
FormatPatterndefault implementation fromFluentBundle. TryGetMessageand similar methods now no longer return{???}.
- Add docs to Plural Rules