fkg-api-proxy/generate-translations.fish

48 lines
2.3 KiB
Fish
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/fish
#TODO: Maybe do this in D (at compile time) instead?
function extractFields
set name $argv[1]
set firstColumn $argv[2]
set secondColumn $argv[3]
# For some tables (e.g. masterStage), commas aren't allowed even in quoted strings (though the Nutaku version handles them just fine)
csvquote | cut -d, -f $firstColumn,$secondColumn | sed "s/\x93/“/g;s/\x94/”/g;s/\x85/…/g;s/\x91//g;s/\x92//g;s/\"/\\\\\"/g;s/\(.*\),\(.*\)/$name\[\1\] = \"\2\";/;s/\x1F/、/g"
end
function extractCsv
set table $argv[1]
jq -r '.master'$table nutakuMaster.json | base64 -d
end
extractCsv 'Character' | extractFields 'characterNames' 1 6 > data/characterNames.data.d
extractCsv 'CharacterSkill' | extractFields 'skillNames' 1 2 > data/skillNames.data.d
extractCsv 'CharacterSkill' | extractFields 'skillDescriptions' 1 7 > data/skillDescriptions.data.d
extractCsv 'Stage' | extractFields 'stageNames' 1 2 > data/stageNames.data.d
extractCsv 'Mission' | extractFields 'missionNames' 1 2 > data/missionNames.data.d
extractCsv 'Mission' | extractFields 'missionDescriptions' 1 3 > data/missionDescriptions.data.d
extractCsv 'Mission' | extractFields 'missionRewards' 1 4 > data/missionRewards.data.d
extractCsv 'Dungeon' | extractFields 'dungeonNames' 10 12 > data/dungeonNames.data.d
extractCsv 'Guest' | extractFields 'guestPartyNames' 1 2 > data/guestPartyNames.data.d
extractCsv 'Item' | extractFields 'itemNames' 1 2 > data/itemNames.data.d
extractCsv 'WorldMap' | extractFields 'worldMapLocationNames' 1 4 > data/worldMapLocationNames.data.d
extractCsv 'WorldMap' | extractFields 'worldMapLocationCaptions' 1 5 > data/worldMapLocationCaptions.data.d
extractCsv 'WorldMap' | extractFields 'worldMapLocationDescriptions' 1 6 > data/worldMapLocationDescriptions.data.d
extractCsv 'CharacterTextResource' | extractFields 'characterTextResource' 1 4 > data/characterTextResource.data.d
extractCsv 'CharacterLeaderSkill' | extractFields 'characterLeaderSkillNames' 1 2 > data/characterLeaderSkillNames.data.d
extractCsv 'CharacterLeaderSkill' | extractFields 'characterLeaderSkillDescriptions' 1 7 > data/characterLeaderSkillDescriptions.data.d
extractCsv 'CharacterBook' | extractFields 'characterBookFlowerLanguage' 1 5 > data/characterBookFlowerLanguage.data.d
extractCsv 'CharacterCategory' | extractFields 'characterCategories' 1 2 > data/characterCategories.data.d