Skip to content

Can't load translations correctly from .ts file #168

Open
@FranciscoHS19

Description

@FranciscoHS19

Hello all,

First, let me thank you for this amazing package :)

I have a .ts file in which I'm storing default system messages:

export const systemMessages = {
	// Success messages
	createSuccess: t.get('staticMessages.createSuccess'),
	updateSuccess: t.get('staticMessages.updateSuccess'),
}

I'm able to use correct translations when making API calls that then use systemMessages and return it to the front-end.
However, when using them directly in a .svelte file and trying to trigger them on an onMount, the message is empty and I get warnings on my browser message saying: "No locale provided for 'staticMessages.createSuccess' key. Skipping translation..." for every single message

onMount(() => {
		const createSuccess = $page.url.searchParams.get('createSuccess');
		if (createSuccess) {
			toastStore.trigger(systemMessages.createSuccess);
		}
	});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions