Add the name of culture and namesbase in the name editor dialog

Added the name of the culture and  namesbase in the dialog "name editor".
This tells information on the "click to generate a culture-specific name"
It tells you the culture before changing name.
This commit is contained in:
Ángel Montero Lamas 2024-01-03 19:02:58 +01:00
parent 845dc893d2
commit 44673c2059
3 changed files with 24 additions and 6 deletions

View file

@ -4612,7 +4612,7 @@
<span data-tip="Speak the name. You can change voice and language in options" class="speaker">🔊</span> <span data-tip="Speak the name. You can change voice and language in options" class="speaker">🔊</span>
<span <span
id="provinceNameEditorShortCulture" id="provinceNameEditorShortCulture"
data-tip="Generate culture-specific name" data-tip="Generate culture-specific name for the province"
class="icon-book pointer" class="icon-book pointer"
></span> ></span>
<span id="provinceNameEditorShortRandom" data-tip="Generate random name" class="icon-globe pointer"></span> <span id="provinceNameEditorShortRandom" data-tip="Generate random name" class="icon-globe pointer"></span>
@ -4688,6 +4688,13 @@
class="icon-arrows-cw pointer" class="icon-arrows-cw pointer"
></span> ></span>
</div> </div>
<div id="provinceCultureName" data-tip="Dominant culture in the province. This decides the naming criteria">
Province culture:&nbsp;<span id="provinceCultureDisplay"></span>
</div>
<div id="provinceCultureBaseName" data-tip="Namesbase used by the dominant culture in the province.">
Province language:&nbsp;<span id="provinceLanguageDisplay"></span>
</div>
</div> </div>
<div id="namesbaseEditor" class="dialog stable textual" style="display: none"> <div id="namesbaseEditor" class="dialog stable textual" style="display: none">

View file

@ -434,13 +434,13 @@ function editStateName(state) {
modules.editStateName = true; modules.editStateName = true;
// add listeners // add listeners
byId("stateNameEditorShortCulture").on("click", regenerateShortNameCuture); byId("stateNameEditorShortCulture").on("click", regenerateShortNameCulture);
byId("stateNameEditorShortRandom").on("click", regenerateShortNameRandom); byId("stateNameEditorShortRandom").on("click", regenerateShortNameRandom);
byId("stateNameEditorAddForm").on("click", addCustomForm); byId("stateNameEditorAddForm").on("click", addCustomForm);
byId("stateNameEditorCustomForm").on("change", addCustomForm); byId("stateNameEditorCustomForm").on("change", addCustomForm);
byId("stateNameEditorFullRegenerate").on("click", regenerateFullName); byId("stateNameEditorFullRegenerate").on("click", regenerateFullName);
function regenerateShortNameCuture() { function regenerateShortNameCulture() {
const state = +stateNameEditor.dataset.state; const state = +stateNameEditor.dataset.state;
const culture = pack.states[state].culture; const culture = pack.states[state].culture;
const name = Names.getState(Names.getCultureShort(culture), culture); const name = Names.getState(Names.getCultureShort(culture), culture);

View file

@ -294,7 +294,7 @@ function editProvinces() {
// move all burgs to a new state // move all burgs to a new state
province.burgs.forEach(b => (burgs[b].state = newStateId)); province.burgs.forEach(b => (burgs[b].state = newStateId));
// difine new state attributes // define new state attributes
const {cell: center, culture} = burgs[burgId]; const {cell: center, culture} = burgs[burgId];
const color = getRandomColor(); const color = getRandomColor();
const coa = province.coa; const coa = province.coa;
@ -501,6 +501,12 @@ function editProvinces() {
applyOption(provinceNameEditorSelectForm, p.formName); applyOption(provinceNameEditorSelectForm, p.formName);
document.getElementById("provinceNameEditorFull").value = p.fullName; document.getElementById("provinceNameEditorFull").value = p.fullName;
const cultureName = pack.cultures[pack.cells.culture[pack.provinces[province].center]].name; // to display the culture name
const provinceLangID = pack.cultures[pack.cells.culture[pack.provinces[province].center]].base;
const provinceNameBase = Names.getNameBases()[provinceLangID].name;
document.getElementById("provinceCultureDisplay").innerText = cultureName;
document.getElementById("provinceLanguageDisplay").innerText = provinceNameBase;
$("#provinceNameEditor").dialog({ $("#provinceNameEditor").dialog({
resizable: false, resizable: false,
title: "Change province name", title: "Change province name",
@ -520,12 +526,17 @@ function editProvinces() {
modules.editProvinceName = true; modules.editProvinceName = true;
// add listeners // add listeners
document.getElementById("provinceNameEditorShortCulture").addEventListener("click", regenerateShortNameCuture); document.getElementById("provinceNameEditorShortCulture").addEventListener("click", regenerateShortNameCulture);
document.getElementById("provinceNameEditorShortRandom").addEventListener("click", regenerateShortNameRandom); document.getElementById("provinceNameEditorShortRandom").addEventListener("click", regenerateShortNameRandom);
document.getElementById("provinceNameEditorAddForm").addEventListener("click", addCustomForm); document.getElementById("provinceNameEditorAddForm").addEventListener("click", addCustomForm);
document.getElementById("provinceNameEditorFullRegenerate").addEventListener("click", regenerateFullName); document.getElementById("provinceNameEditorFullRegenerate").addEventListener("click", regenerateFullName);
function regenerateShortNameCuture() { document.getElementById("provinceNameEditorShortCulture").addEventListener("mouseover", showdatatipNamesbase);
function showdatatipNamesbase() {
tip("namesbase " + this.id + Names.getNameBases()[provinceCultureID].name);
}
function regenerateShortNameCulture() {
const province = +provinceNameEditor.dataset.province; const province = +provinceNameEditor.dataset.province;
const culture = pack.cells.culture[pack.provinces[province].center]; const culture = pack.cells.culture[pack.provinces[province].center];
const name = Names.getState(Names.getCultureShort(culture), culture); const name = Names.getState(Names.getCultureShort(culture), culture);