mirror of
https://github.com/sussy-code/smov.git
synced 2025-01-17 01:51:24 +01:00
Merge pull request #687 from movie-web/fix-666
Specify defaultValue in random extra title
This commit is contained in:
commit
2c4c0edb77
1 changed files with 4 additions and 1 deletions
|
@ -14,7 +14,10 @@ export function useRandomTranslation() {
|
||||||
const defaultTitle = t(`${key}.default`) ?? "";
|
const defaultTitle = t(`${key}.default`) ?? "";
|
||||||
if (!shouldJoke) return defaultTitle;
|
if (!shouldJoke) return defaultTitle;
|
||||||
|
|
||||||
const keys = t(`${key}.extra`, { returnObjects: true });
|
const keys = t(`${key}.extra`, {
|
||||||
|
returnObjects: true,
|
||||||
|
defaultValue: defaultTitle,
|
||||||
|
});
|
||||||
if (Array.isArray(keys)) {
|
if (Array.isArray(keys)) {
|
||||||
if (keys.length === 0) return defaultTitle;
|
if (keys.length === 0) return defaultTitle;
|
||||||
return keys[Math.floor(seed * keys.length)];
|
return keys[Math.floor(seed * keys.length)];
|
||||||
|
|
Loading…
Reference in a new issue