Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FranciscoHS19 opened this issue Feb 2, 2024 · 0 comments
Open

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

FranciscoHS19 opened this issue Feb 2, 2024 · 0 comments

Comments

@FranciscoHS19
Copy link

FranciscoHS19 commented Feb 2, 2024

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);
		}
	});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant