Feature Request: Enforce to view string in specific language #1213
Replies: 4 comments
-
Thanks @elron! :) We are likely opening a discussion about the API of the SDK. I'll keep the proposal in mind/if many people upvote it we will do it anyways. |
Beta Was this translation helpful? Give feedback.
-
Thanks! {#if forcedLocale === 'he'}
{minutes} דקות קריאה
{:else}
{minutes} minutes to read
{/if} |
Beta Was this translation helpful? Give feedback.
-
Use case 1: Use case 2: Part 2: To render a specific messaage in any possible language we will probably need to first implement bundle optimizations or else a user would need to load every possible message in all languages, which is far from ideal. |
Beta Was this translation helpful? Give feedback.
-
Use case 1: export function getLanguageName(tag: string) {
let languageNames = new Intl.DisplayNames([tag], { type: 'language' });
return languageNames.of(tag);
} This is the navigation code: <select name="lang" bind:value={lang}>
{#each languages as lang}
<option value={lang}>{getLanguageName(lang)}</option>
{/each}
</select>
Use case 2: |
Beta Was this translation helpful? Give feedback.
-
Need:
A new argument
forceLanguageTag
to thei()
function.Use case 1 - showing language menu:
en.json
-{ 'languageName': 'English' }
he.json
-{ 'languageName': 'עברית' }
es.json
-{ 'languageName': 'Español' }
Would result better readable code
and avoid using un-sexy find-and-replaces like this:
Use case 2 - when no translation is available.
Why it is important?
I have a notice shown in hebrew "The page is not translated to hebrew yet, showing the english content" (see attached image), and then it shows the english content. If I was to "switch" the user from languge 'he' to 'en' automatically when he visits the post, then the rest of the site would turn english (header, logo, navigation, reading direction, everything) and that would lead to bad user experience, the user may become confused as he does not understand why the language has switched without expecting it. I believe people should feel at home when they visit a website, and a local language is the best way. If I dramatically change the language, they do not expect that and that leads to bad user experience.
Three expected behaviors:
'en'
)referenceLanguage
Beta Was this translation helpful? Give feedback.
All reactions