diff --git a/src/lib/components/lemmy/post/form/PostForm.svelte b/src/lib/components/lemmy/post/form/PostForm.svelte index ee609476..364d536f 100644 --- a/src/lib/components/lemmy/post/form/PostForm.svelte +++ b/src/lib/components/lemmy/post/form/PostForm.svelte @@ -330,7 +330,7 @@ {#if data.url !== undefined} diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index 810c788a..348a85d7 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -912,5 +912,10 @@ "stats": { "joined": "Joined", "created": "Created" + }, + "placeholders": { + "title": "Add a post title", + "body": "What do you have to say?", + "comments": "Join the conversation" } } diff --git a/src/lib/settings.svelte.ts b/src/lib/settings.svelte.ts index 57a31151..44431212 100644 --- a/src/lib/settings.svelte.ts +++ b/src/lib/settings.svelte.ts @@ -143,7 +143,7 @@ export const defaultSettings: Settings = { }, ], }, - randomPlaceholders: toBool(env.PUBLIC_RANDOM_PLACEHOLDERS) ?? true, + randomPlaceholders: toBool(env.PUBLIC_RANDOM_PLACEHOLDERS) ?? false, modlogCardView: toBool(env.PUBLIC_MODLOG_CARD_VIEW) ?? undefined, debugInfo: toBool(env.PUBLIC_DEBUG_INFO) ?? false, expandImages: toBool(env.PUBLIC_EXPAND_IMAGES) ?? true, diff --git a/src/lib/util.svelte.ts b/src/lib/util.svelte.ts index 9e4b158a..11a85f02 100644 --- a/src/lib/util.svelte.ts +++ b/src/lib/util.svelte.ts @@ -7,6 +7,7 @@ import { page } from '$app/state' import { feature } from '$lib/version.js' import { client } from '$lib/lemmy.js' import { site } from './lemmy' +import { t } from './translations' // Despite the name, this will round up // Example: findClosestNumber([8, 16, 32, 64, 128], 76) will return 128 @@ -32,32 +33,38 @@ export const fullCommunityName = (name: string, actorId: string) => `${name}@${new URL(actorId).hostname}` export const placeholders = { - url: ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'], + url: ['https://example.com'], post: [ - 'Is starting nuclear warfare illegal?', - "AITA for making somebody's day?", - 'BREAKING NEWS: Police break into gun shop, find weapons', - 'How do I make sure my pet rock stays alive?', - 'My cat just invented a time machine, what do I do?', - 'Unpopular opinion: world peace would be beneficial to humanity', - 'LPT: The smaller weights are easier to lift than the bigger weights in a gym', - 'ELI5: What is 4 + 8?', + 'Does anybody read these placeholders?', + 'Top 10 reasons why a meteor would help Earth', + 'Title text', + 'I took a picture of something idk', ], + body: ['bottom text', 'body text', 'body text'], comment: [ 'what?', 'new response just dropped', - "i did not read this post at all and i'm about to give my opinion on it.", 'this comment placeholder is very important dont forget', - 'huh. i did not understand any of that.', 'existential crisis in progress', 'hello user i am a sentient placeholder. please dont type anything or i disappear forever. thanks', ], - get: (type: 'url' | 'post' | 'comment') => { - return settings.randomPlaceholders - ? placeholders[type][ - Math.floor(Math.random() * placeholders[type].length) - ] - : '' + get: (type: 'url' | 'post' | 'body' | 'comment') => { + if (settings.randomPlaceholders) { + return placeholders[type][ + Math.floor(Math.random() * placeholders[type].length) + ] + } + + switch (type) { + case 'post': + return t.get('placeholders.title') + case 'body': + return t.get('placeholders.body') + case 'comment': + return t.get('placeholders.comments') + case 'url': + return 'https://example.com' + } }, }