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"}} {{#*inline "editable-input"}}
<div class="editable-text col"> <div class="editable-input editable-{{type}}">
{{#if @root.editable}} {{#if @root.editable}}
<input type="text" name="{{name}}" value="{{value}}" placeholder="{{placeholder}}"> <input type="{{type}}" name="{{name}}" value="{{value}}" placeholder="{{placeholder}}">
{{else}} {{else}}
<div>{{value}}</div> <div>
{{value}}
{{#unless value}}{{placeholder}}{{/unless}}
</div>
{{/if}} {{/if}}
{{#if placeholder}} {{#if placeholder}}
@ -13,22 +16,22 @@
{{/inline}} {{/inline}}
{{#*inline "die-type"}} {{#*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}}
{{#*inline "die-value"}} {{#*inline "die-value"}}
<div class="col"> <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 class="die die-{{type}}">{{lookup @root.actor.system.computed type}}</div>
</div> </div>
{{/inline}} {{/inline}}
<form class="actor-sheet {{ cssClass }}" autocomplete="off"> <form class="actor-sheet {{ cssClass }}" autocomplete="off">
<div class="row"> <div class="row">
{{>editable-text name="name" value=actor.name placeholder="Name"}} {{>editable-input type="text" name="name" value=actor.name placeholder=(localize "DSA41.name")}}
{{>editable-text name="system.race" value=actor.system.race placeholder="Rasse"}} {{>editable-input type="text" name="system.race" value=actor.system.race placeholder=(localize "DSA41.race")}}
{{>editable-text name="system.cultuee" value=actor.system.culture placeholder="Kultur"}} {{>editable-input type="text" name="system.culture" value=actor.system.culture placeholder=(localize "DSA41.culture")}}
{{>editable-text name="system.profession" value=actor.system.profession placeholder="Profession"}} {{>editable-input type="text" name="system.profession" value=actor.system.profession placeholder=(localize "DSA41.profession")}}
</div> </div>
<div class="row"> <div class="row">
<img class="character-image" src="{{ actor.img }}" title="{{ actor.name }}" {{#if editable}}data-edit="img"{{/if}}> <img class="character-image" src="{{ actor.img }}" title="{{ actor.name }}" {{#if editable}}data-edit="img"{{/if}}>
@ -37,31 +40,34 @@
{{/each}} {{/each}}
</div> </div>
<div class="row"> <div class="row">
<table> <fieldset>
<tr> <legend>{{localize "DSA41.attributes.label"}}</legend>
<th></th> <table>
{{#each actor.system.attributes}} <tr>
<th>{{@key}}</th> <th></th>
{{/each}} {{#each actor.system.attributes}}
</tr> <th>{{localize (concat "DSA41.attributes.short." @key)}}</th>
<tr> {{/each}}
<td>Startwert</td> </tr>
{{#each actor.system.attributes}} <tr>
<td>{{>editable-text name=(concat "system.attributes." @key ".initial") value=(lookup this "initial")}}</td> <td>{{localize "DSA41.attributes.initial"}}</td>
{{/each}} {{#each actor.system.attributes}}
</tr> <td>{{>editable-input type="number" name=(concat "system.attributes." @key ".initial") value=(lookup this "initial")}}</td>
<tr> {{/each}}
<td>Steigerungen</td> </tr>
{{#each actor.system.attributes}} <tr>
<td>{{>editable-text name=(concat "system.attributes." @key ".advancement") value=(lookup this "advancement")}}</td> <td>{{localize "DSA41.attributes.advancement"}}</td>
{{/each}} {{#each actor.system.attributes}}
</tr> <td>{{>editable-input type="number" name=(concat "system.attributes." @key ".advancement") value=(lookup this "advancement")}}</td>
<tr> {{/each}}
<td>Modifikatoren</td> </tr>
{{#each actor.system.attributes}} <tr>
<td>{{>editable-text name=(concat "system.attributes." @key ".modifier") value=(lookup this "modifier")}}</td> <td>{{localize "DSA41.attributes.modifier"}}</td>
{{/each}} {{#each actor.system.attributes}}
</tr> <td>{{>editable-input type="number" name=(concat "system.attributes." @key ".modifier") value=(lookup this "modifier")}}</td>
</table> {{/each}}
</tr>
</table>
</fieldset>
</div> </div>
</form> </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 { .placeholder {
font-size: 0.8em; font-size: 0.8em;
border-top: 1px solid; border-top: 1px solid;
} }
.editable-text {
flex: 1;
padding: 0px 3px;
}
.editable-text input {
border: none;
}
.character-image { .character-image {
@ -50,15 +56,24 @@
color: #fff; color: #fff;
} }
.die-MU { background-color: #b22319; } .die-courage { background-color: #b22319; }
.die-KL { background-color: #8158a3; } .die-cleverness { background-color: #8158a3; }
.die-IN { background-color: #388834; } .die-intuition { background-color: #388834; }
.die-CH { background-color: #0c0c0c; } .die-charisma { background-color: #0c0c0c; }
.die-FF { background-color: #d4b366; } .die-dexterity { background-color: #d4b366; }
.die-GE { background-color: #678ec3; } .die-agility { background-color: #678ec3; }
.die-KO { background-color: #a3a3a3; } .die-constitution { background-color: #a3a3a3; }
.die-KK { background-color: #d5a877; } .die-strength { background-color: #d5a877; }
.actor-sheet fieldset {
width: 100%;
}
.actor-sheet table {
border: none;
background: none;
table-layout: fixed;
}
.item-sheet header { .item-sheet header {
display: flex; display: flex;

View File

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

View File

@ -5,6 +5,19 @@
"esmodules": ["src/main.mjs"], "esmodules": ["src/main.mjs"],
"styles": ["src/main.css"], "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", "version": "0.1.5",
"manifest": "https://gitea.ammerhai.com/foundry/dsa-4th-edition/releases/download/latest/system.json", "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" "download": "https://gitea.ammerhai.com/foundry/dsa-4th-edition/releases/download/test2/dsa-4th-edition.zip"