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

Can't use boolean options on number formatting #559

Open
ranisalt opened this issue Jun 1, 2021 · 3 comments
Open

Can't use boolean options on number formatting #559

ranisalt opened this issue Jun 1, 2021 · 3 comments

Comments

@ranisalt
Copy link
Contributor

ranisalt commented Jun 1, 2021

I currently have the following rule:

period = {$season ->
    [spring] Vår {NUMBER($year, useGrouping: false)}
   *[autumn] Höst {NUMBER($year, useGrouping: false)}
}

As per the docs.

However, this just doesn't work, the rule does not apply and displays the untranslated fallback. It looks like the functions don't support boolean values, every other parameter that is a string or number works. If I pass useGrouping: 0 it works, which reinforces that.

@zbraniecki
Copy link
Collaborator

Yup. Our syntax doesn't support booleans - https://github.com/projectfluent/fluent/blob/master/spec/fluent.ebnf#L75

@stasm, @Pike - do you remember how we wanted to workaround it for those cases? Was it supposed to be num->bool, or string->bool ("false" -> false) ?

@eemeli - FYI in context of MF2.0 planning :)

@ranisalt
Copy link
Contributor Author

ranisalt commented Jun 1, 2021

Our syntax doesn't support booleans

I'm new here so sorry if the question is stupid, but couldn't a BooleanLiteral ::= "false" | "true" expression be used I don't think it would be ambiguous in that case.

@Pike
Copy link
Contributor

Pike commented Jun 1, 2021

IIRC, the core problem with "logical" types is that once they're there, you have to figure out what to do with them. That's affecting boolean, but also null and undefined (IIRC, there's a fluent issue on those).

If those logical types were fluent values, they'd need a humane-localized-readable representation. Which is probably not great, or at least a can of worms.

Now, for NamedArgument, we could introduce a BooleanLiteral as Ranieri suggests, but then there's the question what's the path of least surprises throughout all places in Fluent that have literals.

As for the options for NUMBER, I think we had a lot of energy put into the fields and if they're exposed, and if so if to programmers or localizers or both. I don't remember thinking much about the value space of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants