✨ feat: Add language support and descriptions in product localization files
- Added language, languageDescription, and languagePlaceholder fields to product.json for multiple locales (ja-JP, ko-KR, no-NO, pl-PL, pt-BR, ro-RO, ru-RU, th-TH, tr-TR, uk-UA, vi-VN, zh-HK). - Removed group-related fields from product.json for cleaner structure. - Updated API calls in user services to include language parameter for subscription retrieval. - Enhanced type definitions for subscription requests to accommodate language parameter.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { getSubscription } from '@/services/user/portal';
|
||||
import { getLocale } from 'next-intl/server';
|
||||
import Content from './content';
|
||||
|
||||
export default async function Page({
|
||||
@@ -9,9 +10,15 @@ export default async function Page({
|
||||
}>;
|
||||
}) {
|
||||
const { id } = await searchParams;
|
||||
const { data } = await getSubscription({
|
||||
skipErrorHandler: true,
|
||||
});
|
||||
const locale = await getLocale();
|
||||
const { data } = await getSubscription(
|
||||
{
|
||||
language: locale,
|
||||
},
|
||||
{
|
||||
skipErrorHandler: true,
|
||||
},
|
||||
);
|
||||
const subscriptionList = data.data?.list || [];
|
||||
const subscription = subscriptionList.find((item) => item.id === Number(id));
|
||||
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
import { getSubscription } from '@/services/user/portal';
|
||||
import { getLocale } from 'next-intl/server';
|
||||
import { Content } from './content';
|
||||
|
||||
export async function ProductShowcase() {
|
||||
try {
|
||||
const { data } = await getSubscription({
|
||||
skipErrorHandler: true,
|
||||
});
|
||||
const locale = await getLocale();
|
||||
const { data } = await getSubscription(
|
||||
{
|
||||
language: locale,
|
||||
},
|
||||
{
|
||||
skipErrorHandler: true,
|
||||
},
|
||||
);
|
||||
const subscriptionList = data.data?.list || [];
|
||||
|
||||
if (subscriptionList.length === 0) return null;
|
||||
|
||||
@@ -80,11 +80,18 @@ export async function purchase(body: API.PortalPurchaseRequest, options?: { [key
|
||||
}
|
||||
|
||||
/** Get Subscription GET /v1/public/portal/subscribe */
|
||||
export async function getSubscription(options?: { [key: string]: any }) {
|
||||
export async function getSubscription(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.GetSubscriptionParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.GetSubscriptionResponse }>(
|
||||
'/v1/public/portal/subscribe',
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
|
||||
Vendored
+8
@@ -290,6 +290,14 @@ declare namespace API {
|
||||
total: number;
|
||||
};
|
||||
|
||||
type GetSubscriptionParams = {
|
||||
language: string;
|
||||
};
|
||||
|
||||
type GetSubscriptionRequest = {
|
||||
language: string;
|
||||
};
|
||||
|
||||
type GetSubscriptionResponse = {
|
||||
list: Subscribe[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user