Skip to content

Phrase in-context editing integration #448

Answered by ivanhofer
bn3t asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @bn3t,
interesting use case!

You would need to wrap the translation function LL into a Proxy. I have created this example to demonstrate how this could work using the svelte adapter.

src/i18n/i18n-svelte.ts

import { derived } from 'svelte/store'
import { initI18nSvelte } from 'typesafe-i18n/svelte'
import type { Formatters, Locales, TranslationFunctions, Translations } from './i18n-types'
import { loadedFormatters, loadedLocales } from './i18n-util'

const { locale, LL, setLocale } = initI18nSvelte<Locales, Translations, TranslationFunctions, Formatters>(loadedLocales, loadedFormatters)

export { locale, LL, setLocale }

// modified adapter code

let renderKeys = false // control rende…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@bn3t
Comment options

Answer selected by bn3t
Comment options

You must be logged in to vote
1 reply
@bn3t
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants