Skip to content
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

Translate messages shown by Vue components #1523

Open
osma opened this issue Sep 26, 2023 · 2 comments
Open

Translate messages shown by Vue components #1523

osma opened this issue Sep 26, 2023 · 2 comments

Comments

@osma
Copy link
Member

osma commented Sep 26, 2023

For Skosmos 3, we have already implemented UI translations for PHP backend code (PR #1466) and Twig templates (PR #1520). But text in Vue components is not yet translated to the UI language, as can be seen for example in the vocab-counts and term-counts components on the vocabulary home page (the texts "Resource counts by type", "Term counts by language" etc. are currently hardcoded and always shown in English):

image

To fix this, we need to add internationalization support to the Vue components, most likely using Vue i18n.

We also need to provide the Vue components with the correct messages for each language. For Skosmos 2, this was done using global JS variables, like this:

<!-- translations needed in javascript -->
var noResultsTranslation = "Ei tuloksia";
var loading_text = "Ladataan sisältöä";
var loading_failed_text = "Virhe: Lisätulosten haku epäonnistui!";
var loading_retry_text = "Yritä uudelleen";
var jstree_loading = "Ladataan ...";
var results_disp = "Näytetään kaikki %d tulosta";
var all_vocabs  = "kaikista sanastoista";
var n_selected = "sanastosta";
var missing_value = "Kenttä on pakollinen";
var expand_paths = "näytä kaikki # polkua";
var expand_propvals = "näytä kaikki # arvoa";
var hiertrans = "Hierarkia";
var depr_trans = "Käytöstä poistettu käsite";
var sr_only_translations = {
  hierarchy_listing: "Hierarkian mukainen lista käsitteistä",
  groups_listing: "Hierarkian mukainen lista käsitteistä ja ryhmistä",
};

A similar but hopefully less ugly mechanism for passing the messages from the backend to the frontend is needed. One option would be to add the necessary messages to the SKOSMOS global object (see #1438 where it was implemented).

@osma
Copy link
Member Author

osma commented Sep 27, 2023

If we switched to a JSON based message format, it would simplify the implementation of Vue translations as there would be no need to pass specific messages from the backend to the frontend. I opened issue #1525 proposing this.

@osma
Copy link
Member Author

osma commented Oct 10, 2024

Issue #1656 is a near-duplicate of this. But we can consider this issue to be the broader task of translations in all Vue components, while #1656 is about providing the framework for doing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Proposed Skosmos 3.0 issues (to do)
Development

No branches or pull requests

1 participant