Localized (legacy)

The Localized component exported from @nubolab-ffwd/svelte-fluent/legacy is a wrapper around the regular Localized component that allows you to use slots instead of snippets.

import { Localized } from '@nubolab-ffwd/svelte-fluent/legacy';

Props

NameTypeDefaultDescription
idstringundefinedUnique identifier for the translation
argsRecord<string, FluentVariable>undefinedArguments for interpolation

Slots & Slot props

Slots are provided for backwards compatibility. New code should opt to use snippets.

NamePropTypeDescription
defaulttextstringTranslated message
defaultattrsRecord<string, string>Attributes of the translation

Example

<script>
	import { Localized } from '@nubolab-ffwd/svelte-fluent/legacy';
</script>

<Localized id="confirm" let:text let:attrs>
	<div>{text}</div>
	<div>
		<button onclick={() => alert('OK clicked')}>{attrs.ok}</button>
		<button onclick={() => alert('Cancel clicked')}>{attrs.cancel}</button>
	</div>
</Localized>
en.ftl
confirm = Please confirm the action.
  .ok     = Ok
  .cancel = Cancel
Result:
Please confirm the action.