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

[Intl] format to feminine ordinal numbers #3931

Open
JorickPepin opened this issue Dec 7, 2023 · 1 comment
Open

[Intl] format to feminine ordinal numbers #3931

JorickPepin opened this issue Dec 7, 2023 · 1 comment

Comments

@JorickPepin
Copy link

As mentioned in this issue, the addition of the Intl extension should have enabled the display of feminine ordinal numbers through the format_ordinal_number filter (e.g. 1re instead of 1er in French), but is this really the case? If so, how could this be achieved? Thanks in advance.

@smnandre
Copy link
Contributor

In the current implementation, i think you'd code it quicker by yourself in a dedicated extension... than with the IntlExtension.

As you can see in the createNumberFormatter() method, the only way to set textAttributes would be to inject a $prototype ... but even then, you'd only can set "feminine" or "masculine" once.

Or you can try to find another way to add this behaviour line 511 (if the $textAttrs in not usable as right now)

        foreach ($textAttrs as $name => $value) {
            $this->numberFormatters[$hash]->setTextAttribute(self::NUMBER_TEXT_ATTRIBUTES[$name], $value);
        }

        foreach ($symbols as $name => $value) {
            $this->numberFormatters[$hash]->setSymbol(self::NUMBER_SYMBOLS[$name], $value);
        }

+        $this->numberFormatters[$hash]->setTextAttribute(self::NUMBER_TEXT_ATTRIBUTES['default_ruleset'], '%digits-ordinal-feminine');

        return $this->numberFormatters[$hash];
    }
}

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

No branches or pull requests

2 participants