Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
{ hostname: 'plex.tv' },
],
},
transpilePackages: ['country-flag-icons'],
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"preinstall": "npx only-allow pnpm",
"postinstall": "next telemetry disable",
"dev": "nodemon -e ts --watch server --watch seerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts",
"dev": "nodemon -e ts,json,yml --watch server --watch seerr-api.yml --exec 'ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts'",
"build:server": "tsc --project server/tsconfig.json && copyfiles -u 2 server/templates/**/*.{html,pug} dist/templates && copyfiles -u 2 \"server/i18n/locale/*.json\" dist/i18n && tsc-alias -p server/tsconfig.json",
"build:next": "next build",
"build": "pnpm build:next && pnpm build:server",
Expand Down Expand Up @@ -37,9 +37,7 @@
"@dr.pogodin/csurf": "^1.16.9",
"@fontsource-variable/inter": "^5.2.8",
"@formatjs/intl": "^4.1.4",
"@formatjs/intl-displaynames": "7.3.2",
"@formatjs/intl-locale": "5.3.2",
"@formatjs/intl-pluralrules": "6.3.2",
"@headlessui/react": "1.7.19",
"@heroicons/react": "2.2.0",
"@react-spring/web": "^10.0.3",
Expand Down
33 changes: 0 additions & 33 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ CoreApp.getInitialProps = async (initialProps) => {
: currentSettings.locale;

const messages = await loadLocaleData(locale as AvailableLocale);
await polyfillIntl(locale);
await polyfillIntl();

return { ...appInitialProps, user, messages, locale, currentSettings };
};
Expand Down
32 changes: 1 addition & 31 deletions src/utils/polyfillIntl.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
import { shouldPolyfill as shouldPolyfillDisplayNames } from '@formatjs/intl-displaynames/should-polyfill.js';
import { shouldPolyfill as shouldPolyfillLocale } from '@formatjs/intl-locale/should-polyfill.js';
import { shouldPolyfill as shouldPolyfillPluralrules } from '@formatjs/intl-pluralrules/should-polyfill.js';

const polyfillLocale = async () => {
if (shouldPolyfillLocale()) {
await import('@formatjs/intl-locale/polyfill.js');
}
};

const polyfillPluralRules = async (locale: string) => {
const unsupportedLocale = shouldPolyfillPluralrules(locale);
// This locale is supported
if (!unsupportedLocale) {
return;
}
// Load the polyfill 1st BEFORE loading data
await import('@formatjs/intl-pluralrules/polyfill-force.js');
await import(
`@formatjs/intl-pluralrules/locale-data/${unsupportedLocale}.js`
);
};

const polyfillDisplayNames = async (locale: string) => {
const unsupportedLocale = shouldPolyfillDisplayNames(locale);
// This locale is supported
if (!unsupportedLocale) {
return;
}
// Load the polyfill 1st BEFORE loading data
await import('@formatjs/intl-displaynames/polyfill-force.js');
await import(
`@formatjs/intl-displaynames/locale-data/${unsupportedLocale}.js`
);
};

export const polyfillIntl = async (locale: string) => {
export const polyfillIntl = async () => {
await polyfillLocale();
await polyfillPluralRules(locale);
await polyfillDisplayNames(locale);
};
Loading