diff options
author | HiDeoo | 2025-07-11 16:26:59 +0200 |
---|---|---|
committer | GitHub | 2025-07-11 16:26:59 +0200 |
commit | 60e39e23359773af5c3cdbcda9f7d878b77a9e7e (patch) | |
tree | eef107af328dd8d128c6fa75620112098e7c7b5d | |
parent | 13e344035cf39f661571891e5738c1a8efbc9533 (diff) | |
download | IT.starlight-60e39e23359773af5c3cdbcda9f7d878b77a9e7e.tar.gz IT.starlight-60e39e23359773af5c3cdbcda9f7d878b77a9e7e.tar.bz2 IT.starlight-60e39e23359773af5c3cdbcda9f7d878b77a9e7e.zip |
docs: fix `t.exists()` documentation + example (#3287)
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
-rw-r--r-- | docs/src/content/docs/guides/i18n.mdx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/src/content/docs/guides/i18n.mdx b/docs/src/content/docs/guides/i18n.mdx index 45b28ded..e305de8a 100644 --- a/docs/src/content/docs/guides/i18n.mdx +++ b/docs/src/content/docs/guides/i18n.mdx @@ -360,15 +360,15 @@ const allStrings = Astro.locals.t.all(); #### `t.exists()` -To check if a translation key exists for a locale, use the `locals.t.exists()` function with the translation key as first argument. -Pass an optional second argument if you need to override the current locale. +To check if a translation key exists, use the `locals.t.exists()` function with the translation key as first argument. +Pass an optional second argument if you need to check if a translation exists for a specific locale. ```astro --- // src/components/Example.astro -const keyExistsInCurrentLocale = Astro.locals.t.exists('a.key'); +const keyExists = Astro.locals.t.exists('a.key'); // ^ true -const keyExistsInFrench = Astro.locals.t.exists('another.key', { lng: 'fr' }); +const keyExistsInFrench = Astro.locals.t.exists('other.key', { lngs: ['fr'] }); // ^ false --- ``` |