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

No translations are performed when executing locizify-ssg as script #3

Open
Nowaker opened this issue May 26, 2022 · 5 comments
Open

Comments

@Nowaker
Copy link

Nowaker commented May 26, 2022

🐛 Bug Report

A clear and concise description of what the bug is.

To Reproduce

% locizify-ssg -i _gatsby/public/es/index.html -o _gatsby/public/es/index.html -l es -s '{"backend":{"projectId":"3f516219-6546-4f2a-9030-fc31659dc115","apiKey":"xxx","referenceLng":"en"},"fallbackLng":"en","saveMissing":false,"debug":false,"namespace":"root","ns":["common"],"translateAttributes":["placeholder","title","alt","content#meta.name=description","content#meta.name=keywords","content#meta.property","value#input.type=submit","value#input.type=button","value#input.type=reset"],"ignoreTags":["script","style","iframe","svg"]}'

Expected behavior

Translations are applied.

Actual behavior

No changes are made. Before and after are the same.

Workaround

I had to pass lng explicitly inside -s for the changes to be applied correctly.

% locizify-ssg -i _gatsby/public/es/index.html -o _gatsby/public/es/index.html -l es -s '{"backend":{"projectId":"3f516219-6546-4f2a-9030-fc31659dc115","apiKey":"xxx","referenceLng":"en"},"fallbackLng":"en","lng":"es","saveMissing":false,"debug":false,"namespace":"root","ns":["common"],"translateAttributes":["placeholder","title","alt","content#meta.name=description","content#meta.name=keywords","content#meta.property","value#input.type=submit","value#input.type=button","value#input.type=reset"],"ignoreTags":["script","style","iframe","svg"]}'

Your Environment

  • runtime version: 16
  • module version: latest
  • os: Linux
@adrai
Copy link
Contributor

adrai commented May 27, 2022

How does your html look like?
how is locizify initialized (not locizify-ssg)?

btw: seems you have a gatsby project, wouldn't it make more sense to download the translations via locize cli and use something like gatsby-plugin-react-i18next?

@Nowaker
Copy link
Author

Nowaker commented May 27, 2022

how is locizify initialized (not locizify-ssg)?

Not initialized, not embedded, at all. I simply ran locizify-ssg against a static file that does not have any <script> to Locizify.

How does your html look like?

index.tar.gz

btw: seems you have a gatsby project, wouldn't it make more sense to download the translations via locize cli and use something like gatsby-plugin-react-i18next?

In the future - yes. But not at this moment. locizify-ssg fits our current needs better. We have a custom-written JS code that that pretty much what Locizify does but using regexps, and not DOM. locizify-ssg would be a drop-in replacement.

@adrai
Copy link
Contributor

adrai commented May 27, 2022

i think we can close this in favor of #1

@Nowaker
Copy link
Author

Nowaker commented May 27, 2022

#2 and #3 are similar, but describe two separate bugs.

#1 has nothing in comming with #2 and #3.

@adrai
Copy link
Contributor

adrai commented May 27, 2022

just executed your script and it looks the keys it finds are translated, for example:

"Find your perfect domain name..." => "Encuentra tu nombre de dominio perfecto ..." (https://api.locize.app/3f516219-6546-4f2a-9030-fc31659dc115/latest/es/root)
image

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

2 participants