✨ Add crowdin live-translate feature!
This commit is contained in:
@@ -6,6 +6,7 @@ module.exports = {
|
|||||||
defaultLocale: 'en',
|
defaultLocale: 'en',
|
||||||
locales: [
|
locales: [
|
||||||
'en',
|
'en',
|
||||||
|
'cr',
|
||||||
'da',
|
'da',
|
||||||
'he',
|
'he',
|
||||||
'de',
|
'de',
|
||||||
@@ -33,7 +34,7 @@ module.exports = {
|
|||||||
'hu'
|
'hu'
|
||||||
],
|
],
|
||||||
|
|
||||||
localeDetection: true,
|
localeDetection: false,
|
||||||
},
|
},
|
||||||
returnEmptyString: false,
|
returnEmptyString: false,
|
||||||
appendNamespaceToCIMode: true,
|
appendNamespaceToCIMode: true,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ function App(
|
|||||||
const analyticsEnabled = pageProps.analyticsEnabled ?? true;
|
const analyticsEnabled = pageProps.analyticsEnabled ?? true;
|
||||||
// TODO: make mapping from our locales to moment locales
|
// TODO: make mapping from our locales to moment locales
|
||||||
const language = getLanguageByCode(pageProps.session?.user?.language ?? 'en');
|
const language = getLanguageByCode(pageProps.session?.user?.language ?? 'en');
|
||||||
require(`dayjs/locale/${language.locale}.js`);
|
if (language.locale !== 'cr') require(`dayjs/locale/${language.locale}.js`);
|
||||||
dayjs.locale(language.locale);
|
dayjs.locale(language.locale);
|
||||||
|
|
||||||
const [primaryColor, setPrimaryColor] = useState<MantineTheme['primaryColor']>(
|
const [primaryColor, setPrimaryColor] = useState<MantineTheme['primaryColor']>(
|
||||||
@@ -101,12 +101,18 @@ function App(
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CommonHead />
|
<CommonHead />
|
||||||
|
{pageProps.locale === 'cr' && (
|
||||||
|
<>
|
||||||
|
<Script type="text/javascript" src="//cdn.crowdin.com/jipt/jipt.js" />
|
||||||
|
<Script type="text/javascript">var _jipt = []; _jipt.push(['project', 'homarr']);</Script>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{analyticsEnabled === true && (
|
{analyticsEnabled === true && (
|
||||||
<Script
|
<Script
|
||||||
src="https://umami.homarr.dev/script.js"
|
src="https://umami.homarr.dev/script.js"
|
||||||
data-website-id="f133f10c-30a7-4506-889c-3a803f328fa4"
|
data-website-id="f133f10c-30a7-4506-889c-3a803f328fa4"
|
||||||
strategy="lazyOnload"
|
strategy="lazyOnload"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<SessionProvider session={pageProps.session}>
|
<SessionProvider session={pageProps.session}>
|
||||||
<ColorSchemeProvider {...pageProps}>
|
<ColorSchemeProvider {...pageProps}>
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ const SettingsComponent = ({
|
|||||||
boardsData: RouterOutputs['boards']['all'];
|
boardsData: RouterOutputs['boards']['all'];
|
||||||
}) => {
|
}) => {
|
||||||
const languagesData = languages.map((language) => ({
|
const languagesData = languages.map((language) => ({
|
||||||
image: 'https://img.icons8.com/clouds/256/000000/futurama-bender.png',
|
|
||||||
label: language.originalName,
|
label: language.originalName,
|
||||||
description: language.translatedName,
|
description: language.translatedName,
|
||||||
value: language.shortName,
|
value: language.shortName,
|
||||||
@@ -199,8 +198,8 @@ const SelectItem = forwardRef<HTMLDivElement, ItemProps>(
|
|||||||
({ image, label, description, country, ...others }: ItemProps, ref) => (
|
({ image, label, description, country, ...others }: ItemProps, ref) => (
|
||||||
<div ref={ref} {...others}>
|
<div ref={ref} {...others}>
|
||||||
<Group noWrap>
|
<Group noWrap>
|
||||||
<span className={`fi fi-${country?.toLowerCase()}`}></span>
|
{country !== 'CROWDIN' && <span className={`fi fi-${country?.toLowerCase()}`}></span>}
|
||||||
|
{country === 'CROWDIN' && <img src={'https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png'} alt={label} width={16} height={16} />}
|
||||||
<div>
|
<div>
|
||||||
<Text size="sm">{label}</Text>
|
<Text size="sm">{label}</Text>
|
||||||
<Text size="xs" opacity={0.65}>
|
<Text size="xs" opacity={0.65}>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ export type Language = {
|
|||||||
shortName: string;
|
shortName: string;
|
||||||
originalName: string;
|
originalName: string;
|
||||||
translatedName: string;
|
translatedName: string;
|
||||||
emoji: string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The country identified b<y the ISO-3166 alpha 2 code:
|
* The country identified b<y the ISO-3166 alpha 2 code:
|
||||||
@@ -18,7 +17,6 @@ export const languages = [
|
|||||||
shortName: 'de',
|
shortName: 'de',
|
||||||
originalName: 'Deutsch',
|
originalName: 'Deutsch',
|
||||||
translatedName: 'German',
|
translatedName: 'German',
|
||||||
emoji: '🇩🇪',
|
|
||||||
country: 'DE',
|
country: 'DE',
|
||||||
locale: 'de',
|
locale: 'de',
|
||||||
},
|
},
|
||||||
@@ -26,7 +24,6 @@ export const languages = [
|
|||||||
shortName: 'en',
|
shortName: 'en',
|
||||||
originalName: 'English',
|
originalName: 'English',
|
||||||
translatedName: 'English',
|
translatedName: 'English',
|
||||||
emoji: '🇬🇧',
|
|
||||||
country: 'GB',
|
country: 'GB',
|
||||||
locale: 'en-gb',
|
locale: 'en-gb',
|
||||||
},
|
},
|
||||||
@@ -35,7 +32,6 @@ export const languages = [
|
|||||||
shortName: 'da',
|
shortName: 'da',
|
||||||
originalName: 'Dansk',
|
originalName: 'Dansk',
|
||||||
translatedName: 'Danish',
|
translatedName: 'Danish',
|
||||||
emoji: '🇩🇰',
|
|
||||||
country: 'DK',
|
country: 'DK',
|
||||||
locale: 'da',
|
locale: 'da',
|
||||||
},
|
},
|
||||||
@@ -44,7 +40,6 @@ export const languages = [
|
|||||||
shortName: 'he',
|
shortName: 'he',
|
||||||
originalName: 'עברית',
|
originalName: 'עברית',
|
||||||
translatedName: 'Hebrew',
|
translatedName: 'Hebrew',
|
||||||
emoji: '🇮🇱',
|
|
||||||
country: 'IL',
|
country: 'IL',
|
||||||
locale: 'he',
|
locale: 'he',
|
||||||
},
|
},
|
||||||
@@ -52,7 +47,6 @@ export const languages = [
|
|||||||
shortName: 'es',
|
shortName: 'es',
|
||||||
originalName: 'Español',
|
originalName: 'Español',
|
||||||
translatedName: 'Spanish',
|
translatedName: 'Spanish',
|
||||||
emoji: '🇪🇸',
|
|
||||||
country: 'ES',
|
country: 'ES',
|
||||||
locale: 'es',
|
locale: 'es',
|
||||||
},
|
},
|
||||||
@@ -60,7 +54,6 @@ export const languages = [
|
|||||||
shortName: 'fr',
|
shortName: 'fr',
|
||||||
originalName: 'Français',
|
originalName: 'Français',
|
||||||
translatedName: 'French',
|
translatedName: 'French',
|
||||||
emoji: '🇫🇷',
|
|
||||||
country: 'FR',
|
country: 'FR',
|
||||||
locale: 'fr',
|
locale: 'fr',
|
||||||
},
|
},
|
||||||
@@ -68,7 +61,6 @@ export const languages = [
|
|||||||
shortName: 'it',
|
shortName: 'it',
|
||||||
originalName: 'Italiano',
|
originalName: 'Italiano',
|
||||||
translatedName: 'Italian',
|
translatedName: 'Italian',
|
||||||
emoji: '🇮🇹',
|
|
||||||
country: 'IT',
|
country: 'IT',
|
||||||
locale: 'it',
|
locale: 'it',
|
||||||
},
|
},
|
||||||
@@ -76,7 +68,6 @@ export const languages = [
|
|||||||
shortName: 'ja',
|
shortName: 'ja',
|
||||||
originalName: '日本語',
|
originalName: '日本語',
|
||||||
translatedName: 'Japanese',
|
translatedName: 'Japanese',
|
||||||
emoji: '🇯🇵',
|
|
||||||
country: 'JP',
|
country: 'JP',
|
||||||
locale: 'ja',
|
locale: 'ja',
|
||||||
},
|
},
|
||||||
@@ -84,24 +75,14 @@ export const languages = [
|
|||||||
shortName: 'ko',
|
shortName: 'ko',
|
||||||
originalName: '한국어',
|
originalName: '한국어',
|
||||||
translatedName: 'Korean',
|
translatedName: 'Korean',
|
||||||
emoji: '🇰🇷',
|
|
||||||
country: 'KR',
|
country: 'KR',
|
||||||
locale: 'ko',
|
locale: 'ko',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
shortName: 'lol',
|
|
||||||
originalName: 'LOLCAT',
|
|
||||||
translatedName: 'LOLCAT',
|
|
||||||
emoji: '🐱',
|
|
||||||
country: 'LOL',
|
|
||||||
locale: 'en-gb',
|
|
||||||
},
|
|
||||||
// Norwegian
|
// Norwegian
|
||||||
{
|
{
|
||||||
shortName: 'no',
|
shortName: 'no',
|
||||||
originalName: 'Norsk',
|
originalName: 'Norsk',
|
||||||
translatedName: 'Norwegian',
|
translatedName: 'Norwegian',
|
||||||
emoji: '🇳🇴',
|
|
||||||
country: 'NO',
|
country: 'NO',
|
||||||
locale: 'nb',
|
locale: 'nb',
|
||||||
},
|
},
|
||||||
@@ -110,7 +91,6 @@ export const languages = [
|
|||||||
shortName: 'sk',
|
shortName: 'sk',
|
||||||
originalName: 'Slovenčina',
|
originalName: 'Slovenčina',
|
||||||
translatedName: 'Slovak',
|
translatedName: 'Slovak',
|
||||||
emoji: '🇸🇰',
|
|
||||||
country: 'SK',
|
country: 'SK',
|
||||||
locale: 'sk',
|
locale: 'sk',
|
||||||
},
|
},
|
||||||
@@ -118,7 +98,6 @@ export const languages = [
|
|||||||
shortName: 'nl',
|
shortName: 'nl',
|
||||||
originalName: 'Nederlands',
|
originalName: 'Nederlands',
|
||||||
translatedName: 'Dutch',
|
translatedName: 'Dutch',
|
||||||
emoji: '🇳🇱',
|
|
||||||
country: 'NL',
|
country: 'NL',
|
||||||
locale: 'nl',
|
locale: 'nl',
|
||||||
},
|
},
|
||||||
@@ -126,7 +105,6 @@ export const languages = [
|
|||||||
shortName: 'pl',
|
shortName: 'pl',
|
||||||
originalName: 'Polski',
|
originalName: 'Polski',
|
||||||
translatedName: 'Polish',
|
translatedName: 'Polish',
|
||||||
emoji: '🇵🇱',
|
|
||||||
country: 'PL',
|
country: 'PL',
|
||||||
locale: 'pl',
|
locale: 'pl',
|
||||||
},
|
},
|
||||||
@@ -134,7 +112,6 @@ export const languages = [
|
|||||||
shortName: 'pt',
|
shortName: 'pt',
|
||||||
originalName: 'Português',
|
originalName: 'Português',
|
||||||
translatedName: 'Portuguese',
|
translatedName: 'Portuguese',
|
||||||
emoji: '🇵🇹',
|
|
||||||
country: 'PT',
|
country: 'PT',
|
||||||
locale: 'pt',
|
locale: 'pt',
|
||||||
},
|
},
|
||||||
@@ -142,7 +119,6 @@ export const languages = [
|
|||||||
shortName: 'ru',
|
shortName: 'ru',
|
||||||
originalName: 'Русский',
|
originalName: 'Русский',
|
||||||
translatedName: 'Russian',
|
translatedName: 'Russian',
|
||||||
emoji: '🇷🇺',
|
|
||||||
country: 'RU',
|
country: 'RU',
|
||||||
locale: 'ru',
|
locale: 'ru',
|
||||||
},
|
},
|
||||||
@@ -150,7 +126,6 @@ export const languages = [
|
|||||||
shortName: 'sl',
|
shortName: 'sl',
|
||||||
originalName: 'Slovenščina',
|
originalName: 'Slovenščina',
|
||||||
translatedName: 'Slovenian',
|
translatedName: 'Slovenian',
|
||||||
emoji: '🇸🇮',
|
|
||||||
country: 'SI',
|
country: 'SI',
|
||||||
locale: 'sl',
|
locale: 'sl',
|
||||||
},
|
},
|
||||||
@@ -158,7 +133,6 @@ export const languages = [
|
|||||||
shortName: 'sv',
|
shortName: 'sv',
|
||||||
originalName: 'Svenska',
|
originalName: 'Svenska',
|
||||||
translatedName: 'Swedish',
|
translatedName: 'Swedish',
|
||||||
emoji: '🇸🇪',
|
|
||||||
country: 'SE',
|
country: 'SE',
|
||||||
locale: 'sv',
|
locale: 'sv',
|
||||||
},
|
},
|
||||||
@@ -166,7 +140,6 @@ export const languages = [
|
|||||||
shortName: 'uk',
|
shortName: 'uk',
|
||||||
originalName: 'Українська',
|
originalName: 'Українська',
|
||||||
translatedName: 'Ukrainian',
|
translatedName: 'Ukrainian',
|
||||||
emoji: '🇺🇦',
|
|
||||||
country: 'UA',
|
country: 'UA',
|
||||||
locale: 'uk',
|
locale: 'uk',
|
||||||
},
|
},
|
||||||
@@ -175,7 +148,6 @@ export const languages = [
|
|||||||
shortName: 'vi',
|
shortName: 'vi',
|
||||||
originalName: 'Tiếng Việt',
|
originalName: 'Tiếng Việt',
|
||||||
translatedName: 'Vietnamese',
|
translatedName: 'Vietnamese',
|
||||||
emoji: '🇻🇳',
|
|
||||||
country: 'VN',
|
country: 'VN',
|
||||||
locale: 'vi',
|
locale: 'vi',
|
||||||
},
|
},
|
||||||
@@ -183,14 +155,12 @@ export const languages = [
|
|||||||
shortName: 'zh',
|
shortName: 'zh',
|
||||||
originalName: '中文',
|
originalName: '中文',
|
||||||
translatedName: 'Chinese',
|
translatedName: 'Chinese',
|
||||||
emoji: '🇨🇳',
|
|
||||||
country: 'CN',
|
country: 'CN',
|
||||||
locale: 'zh-cn',
|
locale: 'zh-cn',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
originalName: 'Ελληνικά',
|
originalName: 'Ελληνικά',
|
||||||
translatedName: 'Greek',
|
translatedName: 'Greek',
|
||||||
emoji: '🇬🇷',
|
|
||||||
country: 'GR',
|
country: 'GR',
|
||||||
shortName: 'gr',
|
shortName: 'gr',
|
||||||
locale: 'el',
|
locale: 'el',
|
||||||
@@ -199,7 +169,6 @@ export const languages = [
|
|||||||
shortName: 'tr',
|
shortName: 'tr',
|
||||||
originalName: 'Türkçe',
|
originalName: 'Türkçe',
|
||||||
translatedName: 'Turkish',
|
translatedName: 'Turkish',
|
||||||
emoji: '🇹🇷',
|
|
||||||
country: 'TR',
|
country: 'TR',
|
||||||
locale: 'tr',
|
locale: 'tr',
|
||||||
},
|
},
|
||||||
@@ -207,7 +176,6 @@ export const languages = [
|
|||||||
shortName: 'lv',
|
shortName: 'lv',
|
||||||
originalName: 'Latvian',
|
originalName: 'Latvian',
|
||||||
translatedName: 'Latvian',
|
translatedName: 'Latvian',
|
||||||
emoji: '🇱🇻',
|
|
||||||
country: 'LV',
|
country: 'LV',
|
||||||
locale: 'lv',
|
locale: 'lv',
|
||||||
},
|
},
|
||||||
@@ -215,7 +183,6 @@ export const languages = [
|
|||||||
shortName: 'hr',
|
shortName: 'hr',
|
||||||
originalName: 'Hrvatski',
|
originalName: 'Hrvatski',
|
||||||
translatedName: 'Croatian',
|
translatedName: 'Croatian',
|
||||||
emoji: '🇭🇷',
|
|
||||||
country: 'HR',
|
country: 'HR',
|
||||||
locale: 'hr',
|
locale: 'hr',
|
||||||
},
|
},
|
||||||
@@ -224,10 +191,17 @@ export const languages = [
|
|||||||
shortName: 'hu',
|
shortName: 'hu',
|
||||||
originalName: 'Magyar',
|
originalName: 'Magyar',
|
||||||
translatedName: 'Hungarian',
|
translatedName: 'Hungarian',
|
||||||
emoji: '🇭🇺',
|
|
||||||
country: 'HU',
|
country: 'HU',
|
||||||
locale: 'hu',
|
locale: 'hu',
|
||||||
},
|
},
|
||||||
|
// Crowdin Live translate
|
||||||
|
{
|
||||||
|
shortName: 'cr',
|
||||||
|
originalName: 'Crowdin',
|
||||||
|
translatedName: '(Live translation)',
|
||||||
|
country: 'CROWDIN',
|
||||||
|
locale: 'cr',
|
||||||
|
},
|
||||||
] as const satisfies Readonly<Language[]>;
|
] as const satisfies Readonly<Language[]>;
|
||||||
|
|
||||||
export const getLanguageByCode = (code: string | null) =>
|
export const getLanguageByCode = (code: string | null) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user