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

Tags for translations and links #150

Open
eldoy opened this issue Mar 28, 2024 · 0 comments
Open

Tags for translations and links #150

eldoy opened this issue Mar 28, 2024 · 0 comments

Comments

@eldoy
Copy link
Owner

eldoy commented Mar 28, 2024

Instead of doing compile, we do tagmap, which replaces tags with functions instead:

// Instead of this
$.t('pages.index.hello')
$.t('pages.index.hello', 'en')

// We do this
<t key="pages.index.hello">
<t key="pages.index.hello" lang="en">

// Instead of this
<a href="${$.link('hello')}">Hello</a>
<a href="${$.link('en@hello')}">Hello</a>

// We do this
<link name="hello">Hello</link>
<link name="hello" lang="en">Hello</link>
<link name="hello?id=${user_id}" lang="en">Hello</link>

What to do if we want to insert it as attributes?

<input value="<t key='pages.index.hello'>"> ?

Alternatives?

<input value="$t.pages.index.hello@en">
<a href="$link.hello">Hello</a>
<a href="$link.hello@en">Hello</a>

This is shorter and simpler. Completely safe.

How do we do this?

href="${$.link(`en@${$.page.name}`)}"
href="$link.${$.page.name}@en" ?
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