Add weapon translation

This commit is contained in:
2023-04-28 17:21:26 +02:00
parent dd075d2982
commit bc1e23255d
4 changed files with 85 additions and 3 deletions
+4 -1
View File
@@ -10,6 +10,7 @@ import dataLabel from 'chartjs-plugin-datalabels'
import { Weapon, Filters, useKillStore } from '@/stores/kill' import { Weapon, Filters, useKillStore } from '@/stores/kill'
import { Doughnut } from 'vue-chartjs' import { Doughnut } from 'vue-chartjs'
import { defineComponent, PropType } from 'vue' import { defineComponent, PropType } from 'vue'
import weapons from '../stores/weapons.json'
ChartJS.register(ArcElement, Tooltip, Legend, dataLabel) ChartJS.register(ArcElement, Tooltip, Legend, dataLabel)
@@ -101,7 +102,9 @@ export default defineComponent({
plugins: { plugins: {
datalabels: { datalabels: {
formatter: (value: any, context: any) => { formatter: (value: any, context: any) => {
return this.sortedWeaponList[context.dataIndex] const weaponId = this.sortedWeaponList[context.dataIndex]
if (!(weapons as {[key:string]:string})[weaponId]) console.log(weaponId)
return (weapons as {[key:string]:string})[weaponId] || weaponId
}, },
backgroundColor: (context: any) => { backgroundColor: (context: any) => {
return context.dataset.backgroundColor(context) return context.dataset.backgroundColor(context)
+76
View File
@@ -0,0 +1,76 @@
{
"rodeo_battery_removal": "Rodeo Battery Removal",
"human_execution": "Human Execution",
"melee_pilot_kunai": "Kunai Melee",
"execution": "Execution",
"mp_weapon_car": "Car",
"mp_weapon_defender": "Charge Rifle",
"mp_weapon_doubletake": "Double Take",
"mp_weapon_epg": "EPG-1",
"mp_weapon_hemlok_smg": "Volt",
"mp_weapon_lstar": "L-STAR",
"mp_weapon_r97": "R-97",
"mp_weapon_rspn101": "R-201",
"mp_weapon_smart_pistol": "Smart Pistol",
"mp_weapon_sniper": "Kraber",
"mp_weapon_vinson": "Flatline",
"mp_weapon_autopistol": "RE-45 auto",
"mp_weapon_alternator_smg": "Alternator",
"mp_weapon_frag_grenade": "Frag Grenade",
"mp_weapon_g2": "G2",
"mp_weapon_lmg": "Spitfire",
"mp_weapon_smr": "Sidewinder SMR",
"mp_weapon_softball": "Softball",
"mp_weapon_thermite_grenade": "Firestar",
"pilot_emptyhanded": "Melee",
"mp_weapon_mastiff": "Mastiff",
"mp_weapon_mgl": "MGL",
"mp_weapon_rspn101_og": "R-101",
"mp_weapon_wingman": "Wingman",
"invalid": "invalid",
"mp_weapon_arc_launcher": "Thunderbolt",
"mp_weapon_dmr": "DMR",
"mp_weapon_grenade_electric_smoke": "Electric Smoke",
"mp_weapon_pulse_lmg": "Cold War",
"mp_weapon_satchel": "Satchel",
"mp_weapon_shotgun": "EVA-8 Auto",
"mp_weapon_shotgun_pistol": "Mozambique",
"mp_weapon_wingman_n": "Wingman Elite",
"mp_weapon_grenade_gravity": "Gravity Star",
"mp_weapon_grenade_sonar": "Pulse Blade",
"mp_weapon_rocket_launcher": "Archer",
"outOfBounds": "OutOfBounds",
"mind_crime": "Mind Crime",
"mp_weapon_esaw": "Devotion",
"fall": "Fall",
"mp_weapon_semipistol": "P2016",
"mp_weapon_grenade_emp": "Arc Grenade",
"mp_weapon_hemlok": "Hemlok",
"melee_pilot_emptyhanded": "Melee",
"phase_shift": "Phase Shift",
"damagedef_suicide": "Suicide",
"damagedef_titan_hotdrop": "Crushed by Titanfall",
"mp_titanweapon_arc_cannon": "Arc Cannon",
"mp_weapon_peacekraber": "Peacekraber",
"damagedef_crush": "Crushed",
"mp_titanweapon_brute4_quad_rocket": "Quad Rocket Launcher",
"mp_weapon_turretplasma": "Antititan Turret",
"mp_titanweapon_xo16_vanguard": "XO-16",
"mp_titanweapon_sticky_40mm": "40mm Cannon",
"mp_titanweapon_predator_cannon": "Predator Cannon",
"mp_titanweapon_leadwall": "Leadwall",
"mp_titanweapon_sniper": "Plasma Railgun",
"titan_execution": "Titan Execution",
"titan_explosion": "Titan Explosion",
"auto_titan_melee": "Autotitan Melee",
"mp_titanweapon_vortex_shield_ion":"Vortex Shield",
"mp_titanweapon_heat_shield":"Heat shield",
"bubble_shield":"Bubble Shield",
"mp_titancore_salvo_core":"Salvo Core",
"mp_titancore_flame_wave":"Flame Wave",
"mp_titanweapon_flightcore_rockets":"Flight Core",
"mp_titancore_laser_cannon":"Laser Cannon",
"mp_titancore_flame_wave_secondary":"Scorched Earth",
"mp_titanweapon_flame_wall":"Flame Wall",
"mp_titanweapon_arc_wave":"Arc Wave"
}
+4 -2
View File
@@ -16,7 +16,7 @@
:options="groupedServers" group-values="servers" group_label="id" :group-select="false" :allow-empty="true" :multiple="false" :custom-label="((e:any) => e.name)" track-by="name" label="name" :options="groupedServers" group-values="servers" group_label="id" :group-select="false" :allow-empty="true" :multiple="false" :custom-label="((e:any) => e.name)" track-by="name" label="name"
></VueMultiselect> ></VueMultiselect>
<VueMultiselect selectLabel="" deselectLabel="remove" placeholder="Select weapon" v-model="model.weapon" <VueMultiselect selectLabel="" deselectLabel="remove" placeholder="Select weapon" v-model="model.weapon" :custom-label="((e:any) => weaponLocale[e] || e)"
:options="sortedWeaponList" :allow-empty="true" :options="sortedWeaponList" :allow-empty="true"
></VueMultiselect> ></VueMultiselect>
@@ -41,6 +41,7 @@ import WeaponChart from '@/components/WeaponChart.vue'
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import VueMultiselect from 'vue-multiselect' import VueMultiselect from 'vue-multiselect'
import 'vue-multiselect/dist/vue-multiselect.css' import 'vue-multiselect/dist/vue-multiselect.css'
import weapons from '../stores/weapons.json'
export default defineComponent({ export default defineComponent({
name: 'PlayerView', name: 'PlayerView',
@@ -53,7 +54,8 @@ export default defineComponent({
model: { server: undefined, weapon: undefined } as unknown as {weapon:Weapon | Weapon[], server: (Server& {name?:string}) | (Server& {name?:string})[]}, model: { server: undefined, weapon: undefined } as unknown as {weapon:Weapon | Weapon[], server: (Server& {name?:string}) | (Server& {name?:string})[]},
filters: {} as Filters, filters: {} as Filters,
store: useKillStore(), store: useKillStore(),
playerHighlighted: undefined playerHighlighted: undefined,
weaponLocale: weapons as {[key:string]:string}
} }
}, },
computed: { computed: {
+1
View File
@@ -1,5 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"resolveJsonModule":true,
"target": "esnext", "target": "esnext",
"module": "esnext", "module": "esnext",
"strict": true, "strict": true,