Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output files with all-lowercase locale in filename #83

Merged
merged 5 commits into from
Dec 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix static check issues
Albert221 committed Dec 8, 2023
commit 2f51a24af692dc335c3f9bd401a1ab5e19e99859
2 changes: 1 addition & 1 deletion cmd/poe_options_selector.go
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ func prefixFromTemplateFileName(templateFile string) (string, error) {

return "", errors.New(
"invalid template-arb-file. Should be a filename with prefix ending " +
"with an underscore followed by a valid BCP-47 locale.",
"with an underscore followed by a valid BCP-47 locale",
)
}

2 changes: 1 addition & 1 deletion cmd/seed.go
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ func runSeed(cmd *cobra.Command, args []string) error {
var b bytes.Buffer
flutterLocale, err := converter.Convert(&b)
if err != nil {
if errors.Is(err, arb2poe.NoTermsError) {
if errors.Is(err, arb2poe.ErrNoTerms) {
fileLog.Info("no terms to convert")
continue
}
7 changes: 4 additions & 3 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -52,11 +52,12 @@ func getVcsInfo() (revision, time string, modified bool, err error) {
}

for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
switch setting.Key {
case "vcs.revision":
revision = setting.Value
} else if setting.Key == "vcs.time" {
case "vcs.time":
time = setting.Value
} else if setting.Key == "vcs.modified" {
case "vcs.modified":
modified = setting.Value == "true"
}
}
4 changes: 2 additions & 2 deletions convert/arb2poe/converter.go
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ func NewConverter(input io.Reader, templateLocale flutter.Locale, termPrefix str
}
}

var NoTermsError = errors.New("no terms to convert")
var ErrNoTerms = errors.New("no terms to convert")

func (c *Converter) Convert(output io.Writer) (lang flutter.Locale, err error) {
lang, messages, err := parseARB(c.input)
@@ -47,7 +47,7 @@ func (c *Converter) Convert(output io.Writer) (lang flutter.Locale, err error) {
}

if len(poeTerms) == 0 {
return flutter.Locale{}, NoTermsError
return flutter.Locale{}, ErrNoTerms
}

err = json.NewEncoder(output).Encode(poeTerms)