Skip to content

Automatic selection of formatter by argument type #42

Closed
@zbraniecki

Description

@zbraniecki

Fluent implicitly formats arguments in three situations:

  • Numbers in placeables are formatted using NumberFormatter
  • Dates in placeables are formatted using DateFormatter
  • Numbers in selector are formatted using PluralRules

The result is that the following are roughly equivalent:

key = { PLURAL($emailCount) ->
    [one] You have one email
  *[other] You have { NUMBER($emailCount) } emails
key2 = Today is { DATETIME($date) }

and

key = { $emailCount ->
    [one] You have one email
  *[other] You have { $emailCount } emails
key2 = Today is { $date }

The localizer can still decide to use the explicit formatter if they want to pass parameters:

key2 = Today is { DATETIME($date, month: "long") }

but in most cases, the implicit formatting does the job.

Metadata

Metadata

Assignees

No one assigned

    Labels

    formattingIssue pertains to the formatting section of the specrequirementsIssues related with MF requirements list

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions