Skip to content

Commit ca8558e

Browse files
Add support for Hungarian (#710) (#854)
Co-authored-by: Sundeep Narang <[email protected]> Fix: Expired order refund handler (#856)
2 parents 07c769e + 5e08a8c commit ca8558e

File tree

35 files changed

+10536
-538
lines changed

35 files changed

+10536
-538
lines changed

backend/app/Locale.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ enum Locale: string
1313
case FR = 'fr';
1414
case IT = 'it';
1515
case NL = 'nl';
16+
case HU = 'hu';
1617
case ES = 'es';
1718
case PT = 'pt';
1819
case PT_BR = 'pt-br';

backend/app/Services/Domain/Payment/Stripe/StripeAccountSyncService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@ private function updateAccountVerificationStatus(AccountStripePlatformDomainObje
166166
);
167167
}
168168
}
169-
}
169+
}

backend/app/Services/Domain/Payment/Stripe/StripeRefundExpiredOrderService.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
use HiEvents\DomainObjects\OrderDomainObject;
1111
use HiEvents\DomainObjects\OrganizerDomainObject;
1212
use HiEvents\DomainObjects\StripePaymentDomainObject;
13+
use HiEvents\Exceptions\Stripe\StripeClientConfigurationException;
1314
use HiEvents\Mail\Order\PaymentSuccessButOrderExpiredMail;
1415
use HiEvents\Repository\Eloquent\Value\Relationship;
1516
use HiEvents\Repository\Interfaces\EventRepositoryInterface;
17+
use HiEvents\Services\Infrastructure\Stripe\StripeClientFactory;
1618
use HiEvents\Values\MoneyValue;
1719
use Illuminate\Contracts\Mail\Mailer;
1820
use Psr\Log\LoggerInterface;
@@ -26,6 +28,8 @@ public function __construct(
2628
private Mailer $mailer,
2729
private LoggerInterface $logger,
2830
private EventRepositoryInterface $eventRepository,
31+
private StripeClientFactory $stripeClientFactory,
32+
2933
)
3034
{
3135
}
@@ -36,6 +40,7 @@ public function __construct(
3640
* @throws MathException
3741
* @throws UnknownCurrencyException
3842
* @throws NumberFormatException
43+
* @throws StripeClientConfigurationException
3944
*/
4045
public function refundExpiredOrder(
4146
PaymentIntent $paymentIntent,
@@ -48,10 +53,17 @@ public function refundExpiredOrder(
4853
->loadRelation(new Relationship(OrganizerDomainObject::class, name: 'organizer'))
4954
->findById($order->getEventId());
5055

56+
// Determine the correct Stripe platform for this refund
57+
// Use the platform that was used for the original payment
58+
$paymentPlatform = $stripePayment->getStripePlatformEnum();
59+
60+
// Create Stripe client for the original payment's platform
61+
$stripeClient = $this->stripeClientFactory->createForPlatform($paymentPlatform);
5162

5263
$this->refundService->refundPayment(
5364
MoneyValue::fromMinorUnit($paymentIntent->amount, strtoupper($paymentIntent->currency)),
5465
$stripePayment,
66+
$stripeClient
5567
);
5668

5769
$this->mailer

backend/lang/hu.json

Lines changed: 423 additions & 0 deletions
Large diffs are not rendered by default.

frontend/lingui.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const config: LinguiConfig = {
77
"es", // Spanish
88
"fr", // French
99
"nl", // Dutch
10+
"hu", // Hungarian
1011
"pt-br", // Portuguese (Brazil)
1112
"ru", // Russian
1213
"de", // German

frontend/src/components/common/LanguageSwitcher/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export const LanguageSwitcher = () => {
1010
// Ideally these would be in the locales.ts file, but when they're there they don't translate
1111
const getLocaleName = (locale: SupportedLocales): string => {
1212
switch (locale) {
13+
case "hu":
14+
return t`Hungarian`;
1315
case "de":
1416
return t`German`;
1517
case "en":

frontend/src/locales.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
import {i18n} from "@lingui/core";
22
import {t} from "@lingui/macro";
33

4-
export type SupportedLocales = "en" | "de" | "fr" | "it" | "nl" | "pt" | "es" | "zh-cn" | "pt-br" | "vi" |"zh-hk" | "tr";
4+
export type SupportedLocales =
5+
"en"
6+
| "de"
7+
| "fr"
8+
| "it"
9+
| "nl"
10+
| "pt"
11+
| "es"
12+
| "zh-cn"
13+
| "pt-br"
14+
| "vi"
15+
| "zh-hk"
16+
| "tr"
17+
| "hu";
518

6-
export const availableLocales = ["en", "de", "fr", "it", "nl", "pt", "es", "zh-cn", "zh-hk", "pt-br", "vi", "tr"];
19+
export const availableLocales = ["en", "de", "fr", "it", "nl", "pt", "es", "zh-cn", "zh-hk", "pt-br", "vi", "tr", "hu"];
720

821
export const localeToFlagEmojiMap: Record<SupportedLocales, string> = {
922
en: '🇬🇧',
@@ -18,6 +31,7 @@ export const localeToFlagEmojiMap: Record<SupportedLocales, string> = {
1831
"pt-br": '🇧🇷',
1932
vi: '🇻🇳',
2033
tr: '🇹🇷',
34+
hu: '🇭🇺',
2135
};
2236

2337
export const localeToNameMap: Record<SupportedLocales, string> = {
@@ -33,6 +47,7 @@ export const localeToNameMap: Record<SupportedLocales, string> = {
3347
"pt-br": `Portuguese (Brazil)`,
3448
vi: `Vietnamese`,
3549
tr: `Turkish`,
50+
hu: `Hungarian`,
3651
};
3752

3853
export const getLocaleName = (locale: SupportedLocales) => {
@@ -58,10 +73,15 @@ export const getClientLocale = () => {
5873
};
5974

6075
export async function dynamicActivateLocale(locale: string) {
76+
try {
6177
locale = availableLocales.includes(locale) ? locale : "en";
6278
const module = (await import(`./locales/${locale}.po`));
6379
i18n.load(locale, module.messages);
6480
i18n.activate(locale);
81+
} catch (error) {
82+
console.error("Error loading locale:", error);
83+
// i18n.activate("en");
84+
}
6585
}
6686

6787
export const getSupportedLocale = (userLocale: string) => {

frontend/src/locales/de.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)