Releases: MysteriousPotato/lexigo
v0.3.2
v0.3.1
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
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
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
Initial release