Releases: robisim74/qwik-speak
Releases Β· robisim74/qwik-speak
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.2
v0.14.1
v0.14.0
Qwik version: ^1.1.4
- Feat: support params in arrays/objects 0312563
- Merge pull request #54 from robisim74/use-functions 1fefc4f
- Parser: fix conditional params (#52) e3d5ec6
BREAKING CHANGES
Due to problems in recent versions of Qwik, the $translate
function and other translation/localization functions have been removed in favor of use*
functions:
Before
import { $translate as t } from 'qwik-speak';
export default component$(() => {
return (
<h1>{t('app.title@@Qwik Speak')}</h1>
);
});
After
import { useTranslate } from 'qwik-speak';
export default component$(() => {
const t = useTranslate();
return (
<h1>{t('app.title@@Qwik Speak')}</h1>
);
});
Pros
- Better DX experience: you should be able to use the
t
function anywhere incomponent$
(#50 #53 ) - Follows the rules of Qwik (and React)
use*
methods (https://qwik.builder.io/docs/components/tasks/#use-hook-rules) - Access
context
only once per component (previously, each$translate
function accessed the context)
Cons
- More boilerplate code
Other translation/localization functions:
$inlineTranslate
=>inlineTranslate
(only renaming)$plural
=>usePlural
formatDate
=>useFormatDate
formatNumber
=>useFormatNumber
relativeTime
=>useRelativeTime
displayName
=>useDisplayName
The doc is updated.
v0.13.0
- Fix(Inline): $inlineTranslate params 93609f4
- Refactor: remove useTranslate$ 9523857
- Refactor: remove origin from loadTranslation$ aed2570
BREAKING CHANGES
- Remove
useTranslate$
in favor of $inlineTranslate due to better performance - Remove
origin
parameter from the signature ofloadTranslation$
: see here for how to achieve the same usingserver$
if you are fetching json files