fix: stats localisation, marketplace title

This commit is contained in:
David Ralph
2026-01-24 15:33:19 +00:00
parent f58ad986da
commit 8beda77a76
72 changed files with 145 additions and 79 deletions

View File

@@ -4,7 +4,7 @@ export function getBackgroundOptionItems(marketplaceEnabled) {
return [
marketplaceEnabled && {
value: 'photo_pack',
text: variables.getMessage('modals.main.navbar.marketplace'),
text: variables.getMessage('modals.main.marketplace.title'),
},
{
value: 'api',

View File

@@ -269,7 +269,7 @@ function DiscoverContent({ category, onBreadcrumbsChange }) {
opacity: isLoading ? 0 : 1,
transition: 'opacity 0.2s ease-in-out',
}}
title="Marketplace"
title={variables.getMessage('modals.main.marketplace.title')}
/>
</div>
);

View File

@@ -15,15 +15,19 @@ export default function AuthorInfoLegacy({
<>
<div>
<h1 className="quoteauthor">
<a
href={authorlink}
className="quoteAuthorLink"
target="_blank"
rel="noopener noreferrer"
aria-label="Learn about the author of the quote."
>
{author}
</a>
{authorlink ? (
<a
href={authorlink}
className="quoteAuthorLink"
target="_blank"
rel="noopener noreferrer"
aria-label="Learn about the author of the quote."
>
{author}
</a>
) : (
<span>{author}</span>
)}
</h1>
</div>
<div style={{ display: 'flex', justifyContent: 'center', gap: '20px' }}>

View File

@@ -137,15 +137,17 @@ export function useQuoteLoader(updateQuote) {
.flatMap(item => item.quotes.map(quote => ({
...quote,
fallbackauthorimg: item.icon_url,
packName: item.display_name || item.name,
})));
if (quotePack.length === 0) return doOffline();
const data = quotePack[Math.floor(Math.random() * quotePack.length)];
const hasAuthor = data.author && data.author.trim() !== '';
return updateQuote({
quote: `"${data.quote}"`,
author: data.author,
authorlink: getAuthorLink(data.author),
author: hasAuthor ? data.author : data.packName,
authorlink: hasAuthor ? getAuthorLink(data.author) : null,
authorimg: data.fallbackauthorimg,
});
}

View File

@@ -14,9 +14,6 @@ import {
import { Checkbox, Dropdown } from 'components/Form/Settings';
import { Button } from 'components/Elements';
import { toast } from 'react-toastify';
import EventBus from 'utils/eventbus';
const QuoteOptions = () => {
const getCustom = () => {
let data = JSON.parse(localStorage.getItem('customQuote'));
@@ -30,13 +27,6 @@ const QuoteOptions = () => {
const [customQuote, setCustomQuote] = useState(getCustom());
const [sourceSection, setSourceSection] = useState(false);
const resetCustom = () => {
localStorage.setItem('customQuote', '[{"quote": "", "author": ""}]');
setCustomQuote([{ quote: '', author: '' }]);
toast(variables.getMessage('toasts.reset'));
EventBus.emit('refresh', 'background');
};
const handleCustomQuote = (e, text, index, type) => {
const result = text === true ? e.target.value : e.target.result;
@@ -102,7 +92,7 @@ const QuoteOptions = () => {
items={[
localStorage.getItem('quote_packs') && {
value: 'quote_pack',
text: variables.getMessage('modals.main.navbar.marketplace'),
text: variables.getMessage('modals.main.marketplace.title'),
},
{
value: 'api',

View File

@@ -1,37 +1,77 @@
import variables from 'config/variables';
import de_DE from 'i18n/locales/achievements/de_DE.json';
import en_GB from 'i18n/locales/achievements/en_GB.json';
import en_US from 'i18n/locales/achievements/en_US.json';
import es from 'i18n/locales/achievements/es.json';
import fr from 'i18n/locales/achievements/fr.json';
import nl from 'i18n/locales/achievements/nl.json';
import no from 'i18n/locales/achievements/no.json';
import ru from 'i18n/locales/achievements/ru.json';
import zh_CN from 'i18n/locales/achievements/zh_CN.json';
import id_ID from 'i18n/locales/achievements/id_ID.json';
import tr_TR from 'i18n/locales/achievements/tr_TR.json';
import bn from 'i18n/locales/achievements/bn.json';
import pt_BR from 'i18n/locales/achievements/pt_BR.json';
import * as ar from 'i18n/locales/achievements/ar.json';
import * as arz from 'i18n/locales/achievements/arz.json';
import * as az from 'i18n/locales/achievements/az.json';
import * as azb from 'i18n/locales/achievements/azb.json';
import * as bn from 'i18n/locales/achievements/bn.json';
import * as de_DE from 'i18n/locales/achievements/de_DE.json';
import * as el from 'i18n/locales/achievements/el.json';
import * as en_GB from 'i18n/locales/achievements/en_GB.json';
import * as en_US from 'i18n/locales/achievements/en_US.json';
import * as es from 'i18n/locales/achievements/es.json';
import * as es_419 from 'i18n/locales/achievements/es_419.json';
import * as et from 'i18n/locales/achievements/et.json';
import * as fa from 'i18n/locales/achievements/fa.json';
import * as fr from 'i18n/locales/achievements/fr.json';
import * as hu from 'i18n/locales/achievements/hu.json';
import * as id_ID from 'i18n/locales/achievements/id_ID.json';
import * as ja from 'i18n/locales/achievements/ja.json';
import * as lt from 'i18n/locales/achievements/lt.json';
import * as lv from 'i18n/locales/achievements/lv.json';
import * as nl from 'i18n/locales/achievements/nl.json';
import * as no from 'i18n/locales/achievements/no.json';
import * as peo from 'i18n/locales/achievements/peo.json';
import * as pt from 'i18n/locales/achievements/pt.json';
import * as pt_BR from 'i18n/locales/achievements/pt_BR.json';
import * as ru from 'i18n/locales/achievements/ru.json';
import * as sl from 'i18n/locales/achievements/sl.json';
import * as sv from 'i18n/locales/achievements/sv.json';
import * as ta from 'i18n/locales/achievements/ta.json';
import * as tr_TR from 'i18n/locales/achievements/tr_TR.json';
import * as uk from 'i18n/locales/achievements/uk.json';
import * as vi from 'i18n/locales/achievements/vi.json';
import * as zh_CN from 'i18n/locales/achievements/zh_CN.json';
import * as zh_Hant from 'i18n/locales/achievements/zh_Hant.json';
import achievements from 'utils/data/achievements.json';
import { checkAchievements, newAchievements } from './condition';
const translations = {
ar,
arz,
az,
azb,
bn,
de_DE,
el,
en_GB,
en_US,
es,
es_419,
et,
fa,
fr,
hu,
id_ID,
ja,
lt,
lv,
nl,
no,
ru,
zh_CN,
id_ID,
tr_TR,
bn,
peo,
pt,
pt_BR,
ru,
sl,
sv,
ta,
tr_TR,
uk,
vi,
zh_CN,
zh_Hant,
};
// todo: clean this up and condition.js too
@@ -39,10 +79,7 @@ function getLocalisedAchievementData(id) {
const localised = translations[variables.languagecode][id] ||
translations.en_GB[id] || { name: id, description: '' };
return {
name: localised.name,
description: localised.description,
};
return { name: localised.name, description: localised.description };
}
export { achievements, checkAchievements, newAchievements, getLocalisedAchievementData };