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

a way to display translation keys instead of translation values #212

Open
attisimon opened this issue Mar 16, 2023 · 1 comment
Open

a way to display translation keys instead of translation values #212

attisimon opened this issue Mar 16, 2023 · 1 comment

Comments

@attisimon
Copy link

attisimon commented Mar 16, 2023

Hello!

I was wondering if there would be a way to display the translation keys instead of the translation values, exactly the same way as a language/locale selector works for changing the language on page.
This would help to see where a particular translation key is in context, making it easier for translators to understand the context and make a translation that fits.

Thanks!

Note: if the fallbackLocale is set to empty string at init, later on setting a locale that does not exist will make the keys to be displayed on page. This is not ideal for production, but it can be a starting point for a better solution.

import { browser } from '$app/environment'
import { init } from 'svelte-i18n';

init({
  fallbackLocale: '',
  initialLocale: browser ? window.navigator.language : defaultLocale
});

This could also be combined with import.meta.env.MODE, if using Vite, but that is not ideal either, even if it works to differentiate between production and other environments.

@laszlo1337
Copy link

I second that. Would be a great debug tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants