Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

refactor(reaction): update translations of reaction emoji

Timothy Yin105c87c411fb
diff --git a/app/components/photo/ReactionPicker.vue b/app/components/photo/ReactionPicker.vue
index 0fab426b..0dac00b7 100644
--- a/app/components/photo/ReactionPicker.vue
+++ b/app/components/photo/ReactionPicker.vue
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { motion, AnimatePresence } from 'motion-v'
+import { REACTION_DEFINITIONS } from './reaction-definitions'
interface Reaction {
id: string
@@ -38,56 +39,14 @@ onClickOutside(
)
// 可用的表态选项
-const reactions = computed<Reaction[]>(() => [
- {
- id: 'like',
- iconName: 'fluent-emoji-flat:thumbs-up',
- label: $t('viewer.reaction.like'),
- count: props.reactionCounts?.like || 0,
- },
- {
- id: 'love',
- iconName: 'fluent-emoji-flat:red-heart',
- label: $t('viewer.reaction.love'),
- count: props.reactionCounts?.love || 0,
- },
- {
- id: 'amazing',
- iconName: 'fluent-emoji-flat:smiling-face-with-heart-eyes',
- label: $t('viewer.reaction.amazing'),
- count: props.reactionCounts?.amazing || 0,
- },
- {
- id: 'funny',
- iconName: 'fluent-emoji-flat:face-with-tears-of-joy',
- label: $t('viewer.reaction.funny'),
- count: props.reactionCounts?.funny || 0,
- },
- {
- id: 'wow',
- iconName: 'fluent-emoji-flat:face-with-open-mouth',
- label: $t('viewer.reaction.wow'),
- count: props.reactionCounts?.wow || 0,
- },
- {
- id: 'sad',
- iconName: 'fluent-emoji-flat:crying-face',
- label: $t('viewer.reaction.sad'),
- count: props.reactionCounts?.sad || 0,
- },
- {
- id: 'fire',
- iconName: 'fluent-emoji-flat:fire',
- label: $t('viewer.reaction.fire'),
- count: props.reactionCounts?.fire || 0,
- },
- {
- id: 'sparkle',
- iconName: 'fluent-emoji-flat:sparkles',
- label: $t('viewer.reaction.sparkle'),
- count: props.reactionCounts?.sparkle || 0,
- },
-])
+const reactions = computed<Reaction[]>(() =>
+ REACTION_DEFINITIONS.map((reaction) => ({
+ id: reaction.id,
+ iconName: reaction.iconName,
+ label: $t(reaction.labelKey),
+ count: props.reactionCounts?.[reaction.id] || 0,
+ })),
+)
// 格式化数量显示
const formatCount = (count?: number): string => {
diff --git a/app/components/photo/Viewer.vue b/app/components/photo/Viewer.vue
index f33b7798..017ef58a 100644
--- a/app/components/photo/Viewer.vue
+++ b/app/components/photo/Viewer.vue
@@ -12,6 +12,7 @@ import GalleryThumbnail from './GalleryThumbnail.vue'
import InfoPanel from './InfoPanel.vue'
import ReactionPicker from './ReactionPicker.vue'
import ReactionConfetti from './ReactionConfetti.vue'
+import { REACTION_ICON_MAP } from './reaction-definitions'
import type { LoadingIndicatorRef } from './LoadingIndicator.vue'
interface Props {
@@ -49,20 +50,10 @@ const isLoadingReaction = ref(false)
const confettiIcon = ref<string | null>(null)
const confettiTriggerCount = ref(0)
-// 表态图标映射
-const reactionIcons: Record<string, string> = {
- like: 'fluent-emoji-flat:thumbs-up',
- love: 'fluent-emoji-flat:red-heart',
- amazing: 'fluent-emoji-flat:smiling-face-with-heart-eyes',
- funny: 'fluent-emoji-flat:face-with-tears-of-joy',
- wow: 'fluent-emoji-flat:face-with-open-mouth',
- sad: 'fluent-emoji-flat:crying-face',
- fire: 'fluent-emoji-flat:fire',
- sparkle: 'fluent-emoji-flat:sparkles',
-}
-
const currentReactionIcon = computed(() => {
- return selectedReaction.value ? reactionIcons[selectedReaction.value] : null
+ const reactionId = selectedReaction.value
+ if (!reactionId) return null
+ return REACTION_ICON_MAP[reactionId as keyof typeof REACTION_ICON_MAP] || null
})
// 计算总表态数
diff --git a/app/components/photo/reaction-definitions.ts b/app/components/photo/reaction-definitions.ts
new file mode 100644
index 00000000..cfda6706
--- /dev/null
+++ b/app/components/photo/reaction-definitions.ts
@@ -0,0 +1,48 @@
+export const REACTION_DEFINITIONS = [
+ {
+ id: 'like',
+ iconName: 'fluent-emoji-flat:thumbs-up',
+ labelKey: 'viewer.reaction.like',
+ },
+ {
+ id: 'love',
+ iconName: 'fluent-emoji-flat:red-heart',
+ labelKey: 'viewer.reaction.love',
+ },
+ {
+ id: 'amazing',
+ iconName: 'fluent-emoji-flat:smiling-face-with-heart-eyes',
+ labelKey: 'viewer.reaction.amazing',
+ },
+ {
+ id: 'funny',
+ iconName: 'fluent-emoji-flat:face-with-tears-of-joy',
+ labelKey: 'viewer.reaction.funny',
+ },
+ {
+ id: 'wow',
+ iconName: 'fluent-emoji-flat:face-with-open-mouth',
+ labelKey: 'viewer.reaction.wow',
+ },
+ {
+ id: 'sad',
+ iconName: 'fluent-emoji-flat:crying-face',
+ labelKey: 'viewer.reaction.sad',
+ },
+ {
+ id: 'fire',
+ iconName: 'fluent-emoji-flat:fire',
+ labelKey: 'viewer.reaction.fire',
+ },
+ {
+ id: 'sparkle',
+ iconName: 'fluent-emoji-flat:sparkles',
+ labelKey: 'viewer.reaction.sparkle',
+ },
+] as const
+
+export type ReactionId = (typeof REACTION_DEFINITIONS)[number]['id']
+
+export const REACTION_ICON_MAP: Record<ReactionId, string> = Object.fromEntries(
+ REACTION_DEFINITIONS.map((reaction) => [reaction.id, reaction.iconName]),
+) as Record<ReactionId, string>
diff --git a/i18n/locales/en.json b/i18n/locales/en.json
index 7000f700..a48e7517 100644
--- a/i18n/locales/en.json
+++ b/i18n/locales/en.json
@@ -164,14 +164,14 @@
"add": "React",
"change": "Reacted",
"count": "no reactions | {count} reaction | {count} reactions",
- "like": "like",
- "love": "love",
- "amazing": "amazing",
- "funny": "funny",
- "wow": "wow",
- "sad": "sad",
- "fire": "fire",
- "sparkle": "sparkle"
+ "like": "Great shot",
+ "love": "Love",
+ "amazing": "Stunning",
+ "funny": "Haha",
+ "wow": "Whoa",
+ "sad": "Touching",
+ "fire": "Hype",
+ "sparkle": "Shine"
},
"photoload": {
"loadError": "Image loading failed",
diff --git a/i18n/locales/ja.json b/i18n/locales/ja.json
index 633eb050..f6ec9bc8 100644
--- a/i18n/locales/ja.json
+++ b/i18n/locales/ja.json
@@ -163,14 +163,14 @@
"add": "リアクション",
"change": "リアクション済み",
"count": "リアクションなし | {count} 件のリアクション | {count} 件のリアクション",
- "like": "いいね",
- "love": "ハート",
- "amazing": "憧れ",
+ "like": "ナイス",
+ "love": "好き",
+ "amazing": "すごい",
"funny": "笑",
- "wow": "驚",
- "sad": "泣",
- "fire": "炎",
- "sparkle": "星"
+ "wow": "わお",
+ "sad": "感動",
+ "fire": "アツい",
+ "sparkle": "キラッ"
},
"photoload": {
"loadError": "画像の読み込みに失敗しました",
diff --git a/i18n/locales/zh-Hans.json b/i18n/locales/zh-Hans.json
index 34b263fb..abd57e8b 100644
--- a/i18n/locales/zh-Hans.json
+++ b/i18n/locales/zh-Hans.json
@@ -161,14 +161,14 @@
"add": "表态",
"change": "已表态",
"count": "无表态 | {count} 个表态 | {count} 个表态",
- "like": "点赞",
- "love": "爱心",
- "amazing": "花痴",
- "funny": "笑哭了",
- "wow": "吃惊",
- "sad": "哭",
- "fire": "火焰",
- "sparkle": "星星"
+ "like": "拍得好",
+ "love": "喜欢",
+ "amazing": "惊叹",
+ "funny": "哈哈",
+ "wow": "哇塞",
+ "sad": "感动",
+ "fire": "助火",
+ "sparkle": "闪耀"
},
"photoload": {
"loadError": "图片加载失败",
diff --git a/i18n/locales/zh-Hant-HK.json b/i18n/locales/zh-Hant-HK.json
index b09812f4..ee6b8e2f 100644
--- a/i18n/locales/zh-Hant-HK.json
+++ b/i18n/locales/zh-Hant-HK.json
@@ -160,14 +160,14 @@
"add": "表態",
"change": "已表態",
"count": "無表態 | {count} 個表態 | {count} 個表態",
- "like": "讚好",
- "love": "心心",
- "amazing": "花癡",
- "funny": "笑哭",
- "wow": "驚訝",
- "sad": "喊",
- "fire": "火焰",
- "sparkle": "星星"
+ "like": "影得好",
+ "love": "喜歡",
+ "amazing": "驚嘆",
+ "funny": "哈哈",
+ "wow": "嘩塞",
+ "sad": "感動",
+ "fire": "助火",
+ "sparkle": "閃耀"
},
"photoload": {
"loadError": "圖片載入失敗",
diff --git a/i18n/locales/zh-Hant-TW.json b/i18n/locales/zh-Hant-TW.json
index 2b695de3..ab24b25f 100644
--- a/i18n/locales/zh-Hant-TW.json
+++ b/i18n/locales/zh-Hant-TW.json
@@ -160,14 +160,14 @@
"add": "表態",
"change": "已表態",
"count": "無表態 | {count} 個表態 | {count} 個表態",
- "like": "讚",
- "love": "愛心",
- "amazing": "花癡",
- "funny": "笑哭",
- "wow": "驚訝",
- "sad": "哭",
- "fire": "火焰",
- "sparkle": "星星"
+ "like": "拍得好",
+ "love": "喜歡",
+ "amazing": "驚嘆",
+ "funny": "哈哈",
+ "wow": "哇塞",
+ "sad": "感動",
+ "fire": "助火",
+ "sparkle": "閃耀"
},
"photoload": {
"loadError": "圖片載入失敗",