mollie / laravel-cashier-mollie

Official Mollie integration for Laravel Cashier
https://www.cashiermollie.com/
MIT License
137 stars 44 forks source link

Request : Make "Order" translatable #175

Closed codebolt-mike closed 1 year ago

codebolt-mike commented 1 year ago

New request:

Could you please make "Order" translatable? My dutch clients are receiving 'Order ' . $this->number in the Mollie bank-description.

Should be even more awesome if this could be changed in the config, with for example a default text.

vendor/mollie/laravel-cashier-mollie/src/Order/Order.php:243

$payment = (new MandatedPaymentBuilder(
        $owner,
        'Order ' . $this->number,
        $totalDue,
        url(config('cashier.webhook_url')),
        [
             'metadata' => [
                 'temporary_mollie_payment_id' => $this->mollie_payment_id,
             ],
        ]
))->create();
Naoray commented 1 year ago

Hi @codebolt-mike,

sorry for getting back to you so late.

In fact we already have a locale setting in cashier.locale which can be overridden per customer. We could utilize this setting to create a translated string for the payment description.

What do you think of:

// Create Mollie payment
$payment = (new MandatedPaymentBuilder(
    $owner,
    trans('cashier::payment.description', ['number' => $this->number], Cashier::getLocale($owner)),
    $totalDue,
    url(config('cashier.webhook_url')),
    [
        'metadata' => [
            'temporary_mollie_payment_id' => $this->mollie_payment_id,
        ],
    ]
))->create();
codebolt-mike commented 1 year ago

Hi @Naoray,

This looks amazing!

Naoray commented 1 year ago

@codebolt-mike sorry for taking so long!

I’ve submitted the suggestion in #192

sandervanhooft commented 1 year ago

Good one. Before merging though, it may make sense to look at this one in one go.

This is what the default invoice receipt looks like:

image

@Naoray , @codebolt-mike , I'd say every static string here should ideally be translatable with keys included in that same language file. What do you think?

pixels-mike commented 1 year ago

I think that should be perfect. Although in my use-cases I've created a custom invoice layout for e-mail and PDF.

My request was mainly focussed at the non-transferable string for the Mollie receipt that customers get.

All these strings inside a publishable lang-file would even be more perfect in my opinion. That gives future users of this package all the flexibility that a dev could ever want :)

Naoray commented 1 year ago

@sandervanhooft as suggested the invoice receipt is now translatable in #192