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

Translations: Try to use custom translation function (even from hook) #8

Open
marek-hanzal opened this issue Nov 4, 2023 · 0 comments
Assignees

Comments

@marek-hanzal
Copy link
Contributor

With this approach it's possible to extract translations using natural language without using an ID

https://ts-ast-viewer.com/#code/GYVwdgxgLglg9mABFAHgCgIYCcDmB+ALkQCUBTCOLAEwB4BnKLGMHAGkQzAE8A+ASkQBvAFCIxiLKSggsSNFFIBbAA4AbDAqIAVJWo2kAyo2Y46AQSxYMXAQF4eyXeoUA6AFZxmaAEStvAgGpEZWwMRTp3TzAfPz5hAF9hYQowBkQAI3VEW0Q0OwcRMUlpWSFRcQwiAHIARgAmABYq8sTE4VQ0TIw8vgADYDg4DOxEGgweGgB6dIcAEkEqqir4jLh0td6gA

function tx(arg?: Record<string, any>) {
    return (template: TemplateStringsArray) => // do the translation here
}

const bla = () => {
  return {
    a: '124'
  }
}

tx(bla())`foo bar <a></b> ${'d'} bobob`
@marek-hanzal marek-hanzal self-assigned this Nov 4, 2023
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