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

Custom short difinitions for currencies #42

Open
PostScripton opened this issue Dec 27, 2021 · 0 comments
Open

Custom short difinitions for currencies #42

PostScripton opened this issue Dec 27, 2021 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@PostScripton
Copy link
Owner

PostScripton commented Dec 27, 2021

In Russian, we are used to write short definition of ruble like 100 руб., not symbol .
So I'd like to add this functionallity on config level and on built-in currency lists for customizing currencies from different countries.

A use-case may look like:

// config/money.php

return [
    // ...

    'primarily_use_custom_definitions' => true,
    'custom_definitions` => [
        'RUB' => 'руб.'
    ],
];
money(1000)->toString(); // "100 ₽"

money(1000)->withCustomDefinition()->toString(); // "100 руб."

money(1000)->settings()->useCustomDefinition(true)->toString(); // "100 руб."

If there's no custom definition in the config file for the currency, then it just ignores and intended symbol is used ( / RUB).

You can help me out with the method name in the comments below 😄

@PostScripton PostScripton added the enhancement New feature or request label Dec 27, 2021
@PostScripton PostScripton added this to the v3.2 milestone Dec 27, 2021
@PostScripton PostScripton modified the milestones: v3.2, v4.0, v4.1 Jun 27, 2022
@PostScripton PostScripton modified the milestones: v4.1, 4.2 Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant