- 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.CurrentCulture
instead 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.Json
leaking analyzers, causing issues on Mono - Minor tweak of versions of
System.Text.Json
and enabling tests
- Fix issue with
System.Text.Json
causing 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.Serializers
to a separate package - Changed the way
InsertBehavior
works - Add support for net461 @mtkennerly
- Fixed error in
Linguini.Bundle
that prevented term and scope arguments from coexisting. @adcdefg30
- Adds
LinguiniBundle.HasAttrMessage
method - Obsoletes
LinguiniBundle.TryGetAttrMsg
forLinguiniBundle.TryGetAttrMessage
- Obsoletes
LinguiniBundle.TryGetMsg
forLinguiniBundle.TryGetMessage
- Changes default on
LinguiniBundle.SetIsolating
fromtrue
tofalse
- Adds method
GetAttrMessage(string msgWithAttr, params (string, IFluentType)[] args)
for ease of use. - Removes
enum InsertBehavior
in 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
TryReadCharSpan
replaced withTryReadChar
- Methods
IsIdentifier
/IsNumberStart
/IsAsciiDigit
/IsAsciiUppercase
/IsAsciiHexdigit
/IsAsciiAlphabetic
take char rather thanReadOnlySpan<char>
EqualSpans
method removed
- ZeroCopyReader
- method signature
ReadOnlySpan<char> PeekCharSpan(int offset = 0)
changed tochar? PeekChar(int offset = 0)
- method
SeekEol
added. - methods
TryPeekChar
,TryPeekCharAt
,CurrentChar
, andIndexOfAnyChar
added.
- method signature
- ParserError
- factory method for
ExpectedTokens
arguments changed
- factory method for
- LinguiniParser
- changed to use new ZeroCopyUtil internally. Non-breaking changes:
- Fluent bundle private bundle method separated into
AddEntry
andAddEntryOverriding
- 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
UseExperimental
flag 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-gender
selector to neuter i.e.It
. In above example if we set style variable tochicago
,-ship.gender()
it would evaluatefeminine
, soship-gender
would would evaluate toShe
.
-
-
Remove
net5
or greater by -
Move to
net6
and/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]
MakeFluentBundle
abstract 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
FrozenBundle
as 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
,AstTerm
andJunk
). E.g.SelectExpressionBuilder(new VariableReference("x")) .AddVariant("one", new PatternBuilder("select 1")) .AddVariant("other", new PatternBuilder("select other")) .SetDefault(1) .Build();
- Adds
Equals
to mostLinguini.Syntax.Ast
types. - All serializers now have a
Read
method implementation.
- Adds builder for most
- Add
AddResourceOverriding(Resource res)
.
TryGetMessage
returns error if no message was found.- Adds methods
FormatPatternErrRef
,TryGetMessageErrRef
,TryGetAttrMessageErrRef
,TryGetMessageErrRef
inIReadBundle
and associated classes.