(pronouns) allow the user to choose the generated link, defaulting to slashes

it tries to be consistent with the /u/ notation switch in a profile
otherwise, after adding at least one modifier (plural or description),
the compressed format would always be shorter
This commit is contained in:
Valentyne Stigloher 2024-01-12 23:12:21 +01:00
parent b5d57bf19b
commit 63cd06f2e4
4 changed files with 22 additions and 6 deletions

View File

@ -43,6 +43,7 @@ home:
base: 'Based on'
alt: 'You can also enter interchangeable forms in each field separately, eg. <code>him&her</code> = “him” or “her”.'
pronunciation: 'You can also specify the pronunciation after a pipe character, using IPA, eg. <code>faerself|fɛɹsɛlf</code> = “faerself” pronounced as /fɛɹsɛlf/.'
compressedAlternative: 'Use the compressed formatting alternative'
whatisit: 'What''s the deal with pronouns?'
mission:
header: 'Our mission'

View File

@ -41,6 +41,7 @@ home:
Du kannst auch die Aussprache spezifizieren, die indem du nach einem senkrechten Strich „|“ (mit der Tastenkombination <kbd>Alt Gr+&lt;</kbd>) hinzufügst.
Benutze dafür die {https://de.wikipedia.org/wiki/Liste_der_IPA-Zeichen=Lautschrift IPA (Internationales Phonetisches Alphabet)}.
Ein Beispiel wäre: <code>sier|zi:ɐ̯</code> = „sier“, ausgesprochen wie /zi:ɐ̯/.
compressedAlternative: 'komprimierte Formattierung verwenden'
whatisit: 'Was ist das Problem mit Pronomen?'
mission:
header: 'Unsere Mission'

View File

@ -43,6 +43,7 @@ home:
base: 'Based on'
alt: 'You can also enter interchangeable forms in each field separately, eg. <code>him&her</code> = “him” or “her”.'
pronunciation: 'You can also specify the pronunciation after a pipe character, using IPA, eg. <code>faerself|fɛɹsɛlf</code> = “faerself” pronounced as /fɛɹsɛlf/.'
compressedAlternative: 'Use the compressed formatting alternative'
whatisit: 'What''s the deal with pronouns?'
mission:
header: 'Our mission'

View File

@ -75,7 +75,7 @@
v-model="selectedPronoun.description"
class="form-control form-input p-0 form-control-sm"
:size="selectedPronoun.description.length ? selectedPronoun.description.length + 3 : 16"
maxlength="64"
:maxlength="DESCRIPTION_MAXLENGTH"
:placeholder="$t('profile.description')"
>
</template>
@ -128,6 +128,12 @@
</div>
<div v-if="link" class="card-footer">
<LinkInput :link="link" />
<div v-if="config.pronouns.slashes" class="form-check form-switch">
<label>
<input v-model="linkCompressedAlternative" class="form-check-input" type="checkbox">
<T>home.generator.compressedAlternative</T>
</label>
</div>
</div>
</div>
</li>
@ -247,7 +253,7 @@
<script>
import { examples, pronouns, pronounLibrary } from '../src/data.js';
import { ExamplePart } from '../src/classes.js';
import { ExamplePart, Pronoun } from '../src/classes.js';
import Compressor from '../src/compressor.js';
import MORPHEMES from '../data/pronouns/morphemes.js';
import { mapState } from 'vuex';
@ -265,6 +271,7 @@ export default {
// for its' default to prevent a crash
selectedPronoun: pronouns[this.config.pronouns.default].clone(true) ?? 'he',
selectedMorpheme: '',
linkCompressedAlternative: false,
customiseMultiple: false,
multiple: this.config.pronouns.multiple ? this.config.pronouns.multiple.examples[0].split('&') : [],
@ -272,6 +279,8 @@ export default {
customise: this.config.pronouns.autoOpenGenerator || false,
glue: ` ${this.$t('pronouns.or')} `,
DESCRIPTION_MAXLENGTH: Pronoun.DESCRIPTION_MAXLENGTH,
};
},
computed: {
@ -314,11 +323,15 @@ export default {
}
const slashes = this.selectedPronoun.toStringSlashes();
const commas = this.usedBaseEquals ? this.usedBase : this.longLink;
const link = slashes && slashes.length < commas.length
? slashes
: commas;
let link;
if (this.usedBaseEquals) {
link = this.usedBase;
} else if (slashes && !this.linkCompressedAlternative) {
link = slashes;
} else {
link = this.longLink;
}
return this.addSlash(`${this.$base + (this.config.pronouns.prefix || '')}/${link}`);
},