diff --git a/generate-translations.fish b/generate-translations.fish index 15078d8..a501657 100755 --- a/generate-translations.fish +++ b/generate-translations.fish @@ -8,7 +8,7 @@ function extractFields 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/\"/\\\\\"/g;s/\(.*\),\(.*\)/$name\[\1\] = \"\2\";/;s/\x1F/、/g" + 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 @@ -30,3 +30,18 @@ extractCsv 'Mission' | extractFields 'missionRewards' 1 4 > data/missionRewards. 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 diff --git a/source/app.d b/source/app.d index d5da2cb..4cfb854 100644 --- a/source/app.d +++ b/source/app.d @@ -181,6 +181,75 @@ Json handleResponse(string endpoint, Json json) } } + foreach(item; getMasterResponse.masterItem) + { + auto itemId = item[0].to!uint; + + import translations.item; + if(itemId in itemNames) + { + item[1] = itemNames[itemId]; + } + } + + foreach(location; getMasterResponse.masterWorldMap) + { + auto locationId = location[0].to!uint; + + import translations.worldMap; + if(locationId in worldMapLocationNames) + { + location[3] = worldMapLocationNames[locationId]; + location[4] = worldMapLocationCaptions[locationId]; + location[5] = worldMapLocationDescriptions[locationId]; + } + } + + foreach(resource; getMasterResponse.masterCharacterTextResource) + { + auto resourceId = resource[0].to!uint; + + import translations.characterTextResource; + if(resourceId in characterTextResource) + { + resource[3] = characterTextResource[resourceId]; + } + } + + foreach(leaderSkill; getMasterResponse.masterCharacterLeaderSkill) + { + auto leaderSkillId = leaderSkill[0].to!uint; + + import translations.characterLeaderSkill; + if(leaderSkillId in characterLeaderSkillNames) + { + leaderSkill[1] = characterLeaderSkillNames[leaderSkillId]; + leaderSkill[14] = characterLeaderSkillDescriptions[leaderSkillId]; + } + } + + foreach(characterBookEntry; getMasterResponse.masterCharacterBook) + { + auto characterId = characterBookEntry[0].to!uint; + + import translations.characterBook; + if(characterId in characterBookFlowerLanguage) + { + characterBookEntry[5] = characterBookFlowerLanguage[characterId]; + } + } + + foreach(characterCategory; getMasterResponse.masterCharacterCategory) + { + auto categoryId = characterCategory[0].to!uint; + + import translations.characterCategory; + if(categoryId in characterCategories) + { + characterCategory[1] = characterCategories[categoryId]; + } + } + return getMasterResponse.serializeToJson; } diff --git a/source/translations/characterBook.d b/source/translations/characterBook.d new file mode 100644 index 0000000..f0708a9 --- /dev/null +++ b/source/translations/characterBook.d @@ -0,0 +1,8 @@ +module translations.characterBook; + +string[uint] characterBookFlowerLanguage; + +static this() +{ + mixin(import("characterBookFlowerLanguage.data.d")); +} diff --git a/source/translations/characterCategory.d b/source/translations/characterCategory.d new file mode 100644 index 0000000..e0101ae --- /dev/null +++ b/source/translations/characterCategory.d @@ -0,0 +1,8 @@ +module translations.characterCategory; + +string[uint] characterCategories; + +static this() +{ + mixin(import("characterCategories.data.d")); +} diff --git a/source/translations/characterLeaderSkill.d b/source/translations/characterLeaderSkill.d new file mode 100644 index 0000000..c1713c3 --- /dev/null +++ b/source/translations/characterLeaderSkill.d @@ -0,0 +1,10 @@ +module translations.characterLeaderSkill; + +string[uint] characterLeaderSkillNames; +string[uint] characterLeaderSkillDescriptions; + +static this() +{ + mixin(import("characterLeaderSkillNames.data.d")); + mixin(import("characterLeaderSkillDescriptions.data.d")); +} diff --git a/source/translations/characterTextResource.d b/source/translations/characterTextResource.d new file mode 100644 index 0000000..ec08345 --- /dev/null +++ b/source/translations/characterTextResource.d @@ -0,0 +1,8 @@ +module translations.characterTextResource; + +string[uint] characterTextResource; + +static this() +{ + mixin(import("characterTextResource.data.d")); +} diff --git a/source/translations/item.d b/source/translations/item.d new file mode 100644 index 0000000..086d23a --- /dev/null +++ b/source/translations/item.d @@ -0,0 +1,8 @@ +module translations.item; + +string[uint] itemNames; + +static this() +{ + mixin(import("itemNames.data.d")); +} diff --git a/source/translations/worldMap.d b/source/translations/worldMap.d new file mode 100644 index 0000000..045dc76 --- /dev/null +++ b/source/translations/worldMap.d @@ -0,0 +1,12 @@ +module translations.worldMap; + +string[uint] worldMapLocationNames; +string[uint] worldMapLocationCaptions; +string[uint] worldMapLocationDescriptions; + +static this() +{ + mixin(import("worldMapLocationNames.data.d")); + mixin(import("worldMapLocationCaptions.data.d")); + mixin(import("worldMapLocationDescriptions.data.d")); +}