Skip to content

Releases: MysteriousPotato/lexigo

v0.3.2

17 Oct 12:28
Compare
Choose a tag to compare

Fixes

  • Fixed generator not handling country codes
  • Fixed matcher not using the default language properly

Improvements

  • Added language matcher wrapper for caching relatively expensive Match results

v0.3.1

08 Oct 18:45
Compare
Choose a tag to compare

Fixes

  • Fixed name conflict

This issues would occur when nested locales had the same name. The generator now prefixes the type names until no conflict occurs.

Ex.:

{
    "inner": "inner1 {{.Placeholder}}",
    "outer": {
        "inner": "inner2 {{.Placeholder}}"
    }
}

This will create 2 placeholder types named InnerPlaceholders and OuterInnerPlaceholders

Feature

  • Added auto import capability for placeholder types contained outside the generated code package.

v0.3.0

04 Oct 02:11
Compare
Choose a tag to compare

Breaking change

Placeholders type/format syntax has been drastically improved.

  • Lexigo no longer infers type depending on the verb. Inferring the type imposed limitations on typing and did not make sense since verbs can be used on different types.

  • Lexigo now supports all verbs from fmt

  • Types are now explicitly declared

Ex.:

{
    "locale": "Locale number {{.Number:float32(%.2f)}}"
}

Verbs are optional and have a default value depending on type. Omitting to specify a type and verb will result in a placeholder of type string with the %s verb.

Fix

"%" not escaped for locales with placeholders (i.e. using fmt)

v0.2.0

02 Oct 01:05
Compare
Choose a tag to compare

Breaking changes

The New, NewFromString, NewFromTag generated methods have been changed to FromCtx, FromString and FromTag respectively

Feature

A new Locale method is now generated locales. This method will create a locale instance with the given placeholders if applicable.

This will allow users to parse the locale using different languages.

Ex.:

func main() {
    myLocale := path.To.My.Locale.Locale(path.ToMyPlaceholders{
        //...
    })
    fmt.Println(myLocale.FromTag(language.English))
    fmt.Println(myLocale.FromTag(language.German))
}

v0.1.0

01 Oct 20:23
Compare
Choose a tag to compare

Initial release