add localized raid section utility

This commit is contained in:
Justin Edmund 2025-12-20 01:39:44 -08:00
parent a6f79c7c49
commit 5895966c21
3 changed files with 45 additions and 2 deletions

View file

@ -146,5 +146,10 @@
"page_desc_teams": "Save and discover teams to use in Granblue Fantasy",
"page_desc_collection": "Manage your character, weapon, and summon collection",
"page_desc_profile": "Browse {username}'s teams on granblue.team",
"page_desc_party": "Browse this team for {raidName} by {username} on granblue.team"
"page_desc_party": "Browse this team for {raidName} by {username} on granblue.team",
"raid_section_farming": "Farming",
"raid_section_raid": "Raid",
"raid_section_event": "Event",
"raid_section_solo": "Solo"
}

View file

@ -146,5 +146,10 @@
"page_desc_teams": "グラブルで使えるチームを見つけて保存しましょう",
"page_desc_collection": "キャラ、武器、召喚石のコレクションを管理",
"page_desc_profile": "{username}のチームをgranblue.teamで見る",
"page_desc_party": "{raidName}の{username}のチームをgranblue.teamで見る"
"page_desc_party": "{raidName}の{username}のチームをgranblue.teamで見る",
"raid_section_farming": "周回",
"raid_section_raid": "マルチ",
"raid_section_event": "イベント",
"raid_section_solo": "ソロ"
}

View file

@ -0,0 +1,33 @@
/**
* Raid section mapping utilities
*/
import * as m from '$lib/paraglide/messages'
export enum RaidSection {
Farming = 0,
Raid = 1,
Event = 2,
Solo = 3
}
/**
* Get the localized display name for a raid section
*/
export function getRaidSectionLabel(section: number | string | null | undefined): string {
if (section === null || section === undefined) return '-'
const num = typeof section === 'string' ? parseInt(section, 10) : section
switch (num) {
case RaidSection.Farming:
return m.raid_section_farming()
case RaidSection.Raid:
return m.raid_section_raid()
case RaidSection.Event:
return m.raid_section_event()
case RaidSection.Solo:
return m.raid_section_solo()
default:
return '-'
}
}