[tok][profile] convert names to sitelen pona

This commit is contained in:
Andrea Vos 2022-06-23 22:40:54 +02:00
parent 2cecd4bc7a
commit 168ff23132
6 changed files with 35 additions and 8 deletions

View File

@ -15,10 +15,10 @@
<li v-for="author in authors" class="mb-2">
<Icon :v="author.group ? 'users' : 'user'"/>
<a v-if="author.link" :href="author.link" target="_blank" rel="noopener">
<Spelling :text="author.footerName"/>
<Spelling :text="convertName(author.footerName)"/>
</a>
<span v-else>
<Spelling :text="author.footerName"/>
<Spelling :text="convertName(author.footerName)"/>
</span>
<nuxt-link v-if="author.username" :to="`/@${author.username}`" class="badge bg-light text-dark border">
@{{author.username}}
@ -33,7 +33,10 @@
</template>
<script>
import spelling from "../plugins/spelling";
export default {
mixins: [ spelling ],
props: {
bigteam: {type: Boolean},
},

View File

@ -62,7 +62,7 @@
</h3>
<ul class="list-unstyled">
<li v-for="(opinion, name) in profile.names"><Opinion :word="name" :opinion="opinion"/></li>
<li v-for="(opinion, name) in profile.names"><Opinion :word="convertName(name)" :opinion="opinion"/></li>
</ul>
</div>
<div v-if="Object.keys(profile.pronouns).length" :class="['col-6', mainRowCount === 3 ? 'col-lg-4' : 'col-lg-6']">
@ -115,8 +115,10 @@
<script>
import { pronouns } from "~/src/data";
import { buildPronoun } from "../src/buildPronoun";
import spelling from "../plugins/spelling";
export default {
mixins: [ spelling ],
props: {
user: { required: true },
profile: { required: true },

View File

@ -532,6 +532,7 @@ user:
profile:
description: 'lipu suli'
names: 'nimi'
namesInfo: 'You can specify sitelan pona spelling of your name by following the pattern: <code>jan Sewe (soweli e wan esun)</code>' # TODO
pronouns: 'ona'
pronounsInfo: >
You can enter a <strong>pronoun</strong> (eg. “they” or “she/mijer”)

View File

@ -23,6 +23,22 @@ export default {
}
return str;
}
},
convertName(name) {
if (this.config.locale === 'tok') {
const m = name.match(/^jan (.+?) \(((?:[mnptkswlj]?[iueoa][mn]? ?)+)\)$/i);
if (!m) {
return name;
}
if (this.spelling === 'sitelen') {
return 'jan ' + m[2];
}
return 'jan ' + m[1];
}
return name;
},
},
}

View File

@ -29,7 +29,7 @@
<div class="form-group">
<label for="teamName">Team page display name:</label>
<input class="form-control" name="teamName" maxlength="36" v-model="teamName"/>
<input class="form-control" name="teamName" maxlength="64" v-model="teamName"/>
<PropagateCheckbox field="teamName" :before="beforeChanges.teamName" :after="teamName" v-if="otherProfiles > 0" @change="propagateChanged"/>
</div>
@ -44,7 +44,7 @@
<div class="form-group">
<label for="footerName">Footer display name:</label>
<input class="form-control" name="footerName" maxlength="36" v-model="footerName"/>
<input class="form-control" name="footerName" maxlength="64" v-model="footerName"/>
<PropagateCheckbox field="footerName" :before="beforeChanges.footerName" :after="footerName" v-if="otherProfiles > 0" @change="propagateChanged"/>
</div>
@ -97,6 +97,9 @@
<Icon v="signature"/>
<T>profile.names</T>
</h3>
<p v-if="$te('profile.namesInfo')" class="small text-muted">
<T>profile.namesInfo</T>
</p>
<OpinionListInput v-model="names"/>
<PropagateCheckbox field="names" :before="beforeChanges.names" :after="names" v-if="otherProfiles > 0" @change="propagateChanged"/>
</section>

View File

@ -52,7 +52,7 @@
<ul>
<li v-for="credential in credentials">
<strong>{{ credential.credentialsName || credential.teamName }}</strong>
<strong>{{ convertName(credential.credentialsName || credential.teamName) }}</strong>
<a :href="`https://pronouns.page/@${credential.username}`" class="badge bg-light text-dark border">
@{{credential.username}}
</a>
@ -113,7 +113,7 @@
<Avatar :user="member" dsize="4rem"/>
</a>
<span class="ms-2">
{{ member.teamName }}
{{ convertName(member.teamName) }}
<br/>
<a :href="`https://pronouns.page/@${member.username}`" class="badge bg-light text-dark border">
@{{member.username}}
@ -128,8 +128,10 @@
<script>
import { head } from "../src/helpers";
import spelling from "../plugins/spelling";
export default {
mixins: [ spelling ],
head() {
return head({
title: this.$t('contact.team.name'),