add localization

This commit is contained in:
Sven Balzer 2024-09-29 16:36:42 +02:00
parent 68522582fd
commit fa611c356e
6 changed files with 168 additions and 60 deletions

View File

@ -1,9 +1,12 @@
{{#*inline "editable-text"}}
<div class="editable-text col">
{{#*inline "editable-input"}}
<div class="editable-input editable-{{type}}">
{{#if @root.editable}}
<input type="text" name="{{name}}" value="{{value}}" placeholder="{{placeholder}}">
<input type="{{type}}" name="{{name}}" value="{{value}}" placeholder="{{placeholder}}">
{{else}}
<div>{{value}}</div>
<div>
{{value}}
{{#unless value}}{{placeholder}}{{/unless}}
</div>
{{/if}}
{{#if placeholder}}
@ -13,22 +16,22 @@
{{/inline}}
{{#*inline "die-type"}}
<div class="center die die-{{type}}">{{type}}</div>
<div class="center die die-{{type}}">{{localize (concat "DSA41.attributes.short." type)}}</div>
{{/inline}}
{{#*inline "die-value"}}
<div class="col">
<div class="center">{{type}}</div>
<div class="center">{{localize (concat "DSA41.attributes.short." type)}}</div>
<div class="die die-{{type}}">{{lookup @root.actor.system.computed type}}</div>
</div>
{{/inline}}
<form class="actor-sheet {{ cssClass }}" autocomplete="off">
<div class="row">
{{>editable-text name="name" value=actor.name placeholder="Name"}}
{{>editable-text name="system.race" value=actor.system.race placeholder="Rasse"}}
{{>editable-text name="system.cultuee" value=actor.system.culture placeholder="Kultur"}}
{{>editable-text name="system.profession" value=actor.system.profession placeholder="Profession"}}
{{>editable-input type="text" name="name" value=actor.name placeholder=(localize "DSA41.name")}}
{{>editable-input type="text" name="system.race" value=actor.system.race placeholder=(localize "DSA41.race")}}
{{>editable-input type="text" name="system.culture" value=actor.system.culture placeholder=(localize "DSA41.culture")}}
{{>editable-input type="text" name="system.profession" value=actor.system.profession placeholder=(localize "DSA41.profession")}}
</div>
<div class="row">
<img class="character-image" src="{{ actor.img }}" title="{{ actor.name }}" {{#if editable}}data-edit="img"{{/if}}>
@ -37,31 +40,34 @@
{{/each}}
</div>
<div class="row">
<table>
<tr>
<th></th>
{{#each actor.system.attributes}}
<th>{{@key}}</th>
{{/each}}
</tr>
<tr>
<td>Startwert</td>
{{#each actor.system.attributes}}
<td>{{>editable-text name=(concat "system.attributes." @key ".initial") value=(lookup this "initial")}}</td>
{{/each}}
</tr>
<tr>
<td>Steigerungen</td>
{{#each actor.system.attributes}}
<td>{{>editable-text name=(concat "system.attributes." @key ".advancement") value=(lookup this "advancement")}}</td>
{{/each}}
</tr>
<tr>
<td>Modifikatoren</td>
{{#each actor.system.attributes}}
<td>{{>editable-text name=(concat "system.attributes." @key ".modifier") value=(lookup this "modifier")}}</td>
{{/each}}
</tr>
</table>
<fieldset>
<legend>{{localize "DSA41.attributes.label"}}</legend>
<table>
<tr>
<th></th>
{{#each actor.system.attributes}}
<th>{{localize (concat "DSA41.attributes.short." @key)}}</th>
{{/each}}
</tr>
<tr>
<td>{{localize "DSA41.attributes.initial"}}</td>
{{#each actor.system.attributes}}
<td>{{>editable-input type="number" name=(concat "system.attributes." @key ".initial") value=(lookup this "initial")}}</td>
{{/each}}
</tr>
<tr>
<td>{{localize "DSA41.attributes.advancement"}}</td>
{{#each actor.system.attributes}}
<td>{{>editable-input type="number" name=(concat "system.attributes." @key ".advancement") value=(lookup this "advancement")}}</td>
{{/each}}
</tr>
<tr>
<td>{{localize "DSA41.attributes.modifier"}}</td>
{{#each actor.system.attributes}}
<td>{{>editable-input type="number" name=(concat "system.attributes." @key ".modifier") value=(lookup this "modifier")}}</td>
{{/each}}
</tr>
</table>
</fieldset>
</div>
</form>

37
src/lang/de.json Normal file
View File

@ -0,0 +1,37 @@
{
"DSA41": {
"name": "Name",
"race": "Rasse",
"culture": "Kultur",
"profession": "Profession",
"attributes": {
"label": "Eigenschaften",
"initial": "Startwert",
"advancement": "Steigerungen",
"modifier": "Modifikatoren",
"long": {
"courage": "Mut",
"cleverness": "Klugheit",
"intuition": "Intuition",
"charisma": "Charisma",
"dexterity": "Fingerfertigkeit",
"agility": "Gewandheit",
"constitution": "Konstitution",
"strength": "Körperkraft"
},
"short": {
"courage": "MU",
"cleverness": "KL",
"intuition": "IN",
"charisma": "CH",
"dexterity": "FF",
"agility": "GE",
"constitution": "KO",
"strength": "KK"
}
}
}
}

37
src/lang/en.json Normal file
View File

@ -0,0 +1,37 @@
{
"DSA41": {
"name": "Name",
"race": "Race",
"culture": "Culture",
"profession": "Profession",
"attributes": {
"label": "Attributes",
"initial": "Initial",
"advancement": "Advancements",
"modifier": "Modifiers",
"long": {
"courage": "Courage",
"cleverness": "Cleverness",
"intuition": "Intuition",
"charisma": "Charisma",
"dexterity": "Dexterity",
"agility": "Agility",
"constitution": "Constitution",
"strength": "Strength"
},
"short": {
"courage": "CO",
"cleverness": "CL",
"intuition": "IN",
"charisma": "CH",
"dexterity": "DE",
"agility": "AG",
"constitution": "CN",
"strength": "ST"
}
}
}
}

View File

@ -17,19 +17,25 @@
}
.editable-input {
flex: 1;
padding: 0px 3px;
}
.editable-input input {
border: none;
}
.editable-number {
text-align: center;
}
.placeholder {
font-size: 0.8em;
border-top: 1px solid;
}
.editable-text {
flex: 1;
padding: 0px 3px;
}
.editable-text input {
border: none;
}
.character-image {
@ -50,15 +56,24 @@
color: #fff;
}
.die-MU { background-color: #b22319; }
.die-KL { background-color: #8158a3; }
.die-IN { background-color: #388834; }
.die-CH { background-color: #0c0c0c; }
.die-FF { background-color: #d4b366; }
.die-GE { background-color: #678ec3; }
.die-KO { background-color: #a3a3a3; }
.die-KK { background-color: #d5a877; }
.die-courage { background-color: #b22319; }
.die-cleverness { background-color: #8158a3; }
.die-intuition { background-color: #388834; }
.die-charisma { background-color: #0c0c0c; }
.die-dexterity { background-color: #d4b366; }
.die-agility { background-color: #678ec3; }
.die-constitution { background-color: #a3a3a3; }
.die-strength { background-color: #d5a877; }
.actor-sheet fieldset {
width: 100%;
}
.actor-sheet table {
border: none;
background: none;
table-layout: fixed;
}
.item-sheet header {
display: flex;

View File

@ -44,14 +44,14 @@ class DSA41_CharacterData extends foundry.abstract.TypeDataModel {
profession: new StringField(),
attributes: new SchemaField({
MU: new AttributeField(),
KL: new AttributeField(),
IN: new AttributeField(),
CH: new AttributeField(),
FF: new AttributeField(),
GE: new AttributeField(),
KO: new AttributeField(),
KK: new AttributeField(),
courage: new AttributeField(),
cleverness: new AttributeField(),
intuition: new AttributeField(),
charisma: new AttributeField(),
dexterity: new AttributeField(),
agility: new AttributeField(),
constitution: new AttributeField(),
strength: new AttributeField(),
}),
}
}

View File

@ -5,6 +5,19 @@
"esmodules": ["src/main.mjs"],
"styles": ["src/main.css"],
"languages": [
{
"lang": "de",
"name": "German (Deutsch)",
"path": "src/lang/de.json"
},
{
"lang": "en",
"name": "English",
"path": "src/lang/en.json"
}
],
"version": "0.1.5",
"manifest": "https://gitea.ammerhai.com/foundry/dsa-4th-edition/releases/download/latest/system.json",
"download": "https://gitea.ammerhai.com/foundry/dsa-4th-edition/releases/download/test2/dsa-4th-edition.zip"