-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SRO] Organize DM-l10n strings #2491
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './allCharacters' | ||
export * from './character' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,47 +4,71 @@ import { | |
allLightConeKeys, | ||
allRelicSetKeys, | ||
} from '@genshin-optimizer/sr/consts' | ||
import { charHashData } from './charHashData' | ||
import { lightConeHashData } from './lightConeHashData' | ||
import { relicHashData } from './relicHashData' | ||
import { sheetHashData } from './sheetHashData' | ||
import { allCharHashData, charHashData } from './charHashData' | ||
import { allLightConeHashData, lightConeHashData } from './lightConeHashData' | ||
import { allRelicHashData, relicHashData } from './relicHashData' | ||
import { uiHashData } from './uiHashData' | ||
|
||
export type LanguageData = typeof HashData | ||
|
||
const charNames = Object.fromEntries( | ||
Object.entries(charHashData).map(([key, data]) => [key, data.name]) | ||
Object.entries(allCharHashData).map(([key, data]) => [key, data.name]) | ||
) | ||
verifyObjKeys(charNames, allCharacterDataKeys) | ||
|
||
const relicNames = Object.fromEntries( | ||
Object.entries(relicHashData).map(([key, data]) => [key, data.setName]) | ||
Object.entries(allRelicHashData).map(([key, data]) => [key, data.setName]) | ||
) | ||
verifyObjKeys(relicNames, allRelicSetKeys) | ||
|
||
const lightConeNames = Object.fromEntries( | ||
Object.entries(lightConeHashData).map(([key, data]) => [key, data.name]) | ||
Object.entries(allLightConeHashData).map(([key, data]) => [key, data.name]) | ||
) | ||
verifyObjKeys(lightConeNames, allLightConeKeys) | ||
|
||
export const HashData = { | ||
char: charHashData, | ||
char: allCharHashData, | ||
charNames, | ||
characters: charHashData, | ||
|
||
relic: relicHashData, | ||
relic: allRelicHashData, | ||
relicNames, | ||
relics: relicHashData, | ||
|
||
lightCone: lightConeHashData, | ||
lightCone: allLightConeHashData, | ||
lightConeNames, | ||
lightCones: lightConeHashData, | ||
|
||
sheet: sheetHashData, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the reason why we have separated namespace -> separated .JSON is that translations are usually lazy loaded. when the artifact page is loaded, it doesn't need any of the character/team UI translations, and vice versa. This can impact load time of pages and elements, since most of our elements are behind loading barriers and suspenses. we can designate some of the namespace to be permanently loaded(i think "ui" is). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's understandable, and in this commit I split up a lot more of the namespaces in light of this information. Though, it also means I'm not quite sure where to put some of these smaller namespaces (e.g. common, team, paths, statKey) or what the file should be ( |
||
slotKey: { | ||
head: '1826268247', | ||
hands: '-2144127003', | ||
body: '1799740313', | ||
feet: '1154536283', | ||
sphere: '1873322474', | ||
rope: '74129613', | ||
ui: uiHashData, | ||
|
||
common: { | ||
level: '-636045037', // Level | ||
lv: '982642653', // Lv. | ||
rarity: '1898197464', | ||
}, | ||
|
||
teams: { | ||
label: '-839489437', // Team | ||
name: '858715661', // Team Name | ||
editTeam: '-756448810', | ||
}, | ||
|
||
paths: { | ||
label: { | ||
one: '-1952347303', // Path | ||
many: '-815380608', // Paths | ||
}, | ||
pathKey: { | ||
Erudition: '-953720572', | ||
Preservation: '-1357005099', | ||
Abundance: '1371878256', | ||
Nihility: '-1760289626', | ||
Destruction: '209078842', | ||
Harmony: '-194205685', | ||
TheHunt: '612363369', | ||
}, | ||
}, | ||
|
||
statKey: { | ||
spd: '461357812', | ||
spd_: '461357812', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './allLightCones' | ||
export * from './lightCone' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const lightConeHashData = { | ||
label: { | ||
one: '-514739711', // Light Cone | ||
many: '582917607', // Light Cones | ||
}, | ||
superimposition: '-2008197403', | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './allRelics' | ||
export * from './relic' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const relicHashData = { | ||
label: '-1823495414', // Relics | ||
set: '1604210092', | ||
mainStat: '-338586359', | ||
slot: '-1409515362', | ||
slotKey: { | ||
head: '1826268247', | ||
hands: '-2144127003', | ||
body: '1799740313', | ||
feet: '1154536283', | ||
sphere: '1873322474', | ||
rope: '74129613', | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,10 @@ export type InterpolationTag = keyof typeof interpolationTags | |
// Process tags in string to template for i18n | ||
function processString(str: string | undefined) { | ||
if (str === undefined) str = '' | ||
|
||
// Remove '{SPACE}' artifacts from certain strings | ||
// Do this first to match curly brackets to prevent interfering with later str replacements | ||
str = str.replace(/(.*?){SPACE}/g, '$1') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Certain strings will contain |
||
// Find portion similar to | ||
// <color=#f29e38ff><unbreak>#1[i]%</unbreak></color> | ||
// replaces with '<color=#f29e38ff>#1[i]%</color>' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
export const uiHashData = { | ||
confirm: '35141102', | ||
cancel: '-923369432', | ||
|
||
open: '554533651', | ||
close: '-316424440', | ||
|
||
edit: '71676923', | ||
preview: '1494310683', | ||
save: '922770375', | ||
delete: '1854908959', | ||
clear: '-644581385', | ||
reset: '1035909461', | ||
|
||
add: '627092858', | ||
remove: '1045883501', | ||
|
||
locked: '936395545', | ||
unlocked: '2032806954', | ||
lockAll: '1539252863', | ||
unlockAll: '-26831078', | ||
|
||
excluded: '-1904552378', | ||
includeSelected: '1476839551', | ||
excludeSelected: '-1093811249', | ||
|
||
activated: '-1242210091', | ||
notActivated: '-732278832', | ||
|
||
equipped: '1791115444', | ||
unequipped: '-202463180', | ||
currentlyEquipped: '1354485618', | ||
notEquipped: '961141924', | ||
|
||
equip: '-1174264395', | ||
switch: '310431922', | ||
compare: '111565860', | ||
|
||
search: '1781769983', | ||
filter: '-1811155248', | ||
empty: '681643565', | ||
|
||
inventory: '888911468', | ||
settings: '-1818257148', | ||
|
||
gender: { | ||
F: '732414811', | ||
M: '1491929698', | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are better name/organization suggestions from what I've done in this commit (move all related files into related folders and rename the original files generating all chars/LCs/relics + their data into terms that possibly better indicate that they're for 'generating all assets for a category'), please let me know.