Skip to content

CLDR-4152 show alternate locale in info panel #3570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tools/cldr-apps/js/src/views/InfoPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<template>
<div>
<div v-if="altText" class="secondary">
<i>{{ altLang }}: </i
><cldr-value @lang="altLang"> {{ altText }} </cldr-value>
</div>
<div>
<a-input placeholder="fr" v-model:value="altLang">
<template #prefix> Other Lang: </template>
</a-input>
</div>
<section id="InfoPanelSection">
<header class="sidebyside-column-top">
<button
Expand Down Expand Up @@ -38,7 +47,12 @@
import { ref } from "vue";
import * as cldrInfo from "../esm/cldrInfo.mjs";
import * as cldrStatus from "../esm/cldrStatus.mjs";
import * as cldrClient from "../esm/cldrClient.mjs";
import InheritanceExplainer from "./InheritanceExplainer.vue";
import CldrValue from "./CldrValue.vue";

const altText = ref("");
const altLang = ref("");

export default {
setup() {
Expand All @@ -47,8 +61,27 @@ export default {
inheritanceExplainer,
locale: cldrStatus.refs.currentLocale,
id: cldrStatus.refs.currentId,
altLang,
altText,
};
},
watch: {
async id(xpstrid) {
if (!altLang.value) {
altText.value = "";
return;
}
const client = await cldrClient.getClient();
const locale = altLang.value;
const { body } = await client.apis.voting.getRow({ xpstrid, locale });
const { page } = body;
const { rows } = page;
const row = Object.entries(rows)[0][1];
const { winningValue } = row;
// ↑↑↑
altText.value = winningValue || "";
},
},
components: {
InheritanceExplainer,
},
Expand Down