next-translate icon indicating copy to clipboard operation
next-translate copied to clipboard

i18nAlly support

Open aralroca opened this issue 2 years ago • 3 comments

Discussed in https://github.com/aralroca/next-translate/discussions/902

Originally posted by mkbctrl August 26, 2022 Hey,

did anyone successfully setup the VScode i18n Ally extension to work with next-translate? Usually it does work out of the box, the only thing that I frequently change is the path to locale files. In next-translate case I am unable to make it work.

I have the latest version of both VScode (1.70.2) and the extension (2.8.1).

Here's my example component:

image Screenshot 2022-08-26 at 13 42 23

locales file auth.json:

{
  "header": {
    "title": "Create Your Free Account",
    "subTitle": "Already have an account?",
    "link": "Sign in"
  },
  "divider": { "text": "or" },
  "policy": {
    "text": "By signing up you agree to our",
    "link": "privacy policy"
  }
}

The settings I changed are the following:

 "i18n-ally.localesPaths": ["locales"],
  "i18n-ally.extract.keyPrefix": "{fileName}", // so I assume when I type: "header.title" the extension should make it "auth.header.title" or am I dumb?

folder structure: Screenshot 2022-08-26 at 13 38 38

config:

{
  "locales": ["en"],
  "defaultLocale": "en",
  "pages": {
    "/auth/sign-up": ["auth"]
  }
}

Anyone had any issues with that extension in the past? Did I miss smth?

The only case when the autocompletion works is when I type the full path:

https://user-images.githubusercontent.com/10107362/186896388-4148629a-bf02-478a-806d-f1c038d3e309.mov

Screenshot 2022-08-26 at 13 46 05

but it doesn't render the text but the string path (auth.header.link) in my frontend app...

aralroca avatar Feb 17 '23 20:02 aralroca

@mkbctrl I see that in theory they support next-translate https://github.com/lokalise/i18n-ally/blob/435df209ec85bd43181a24635f268dce9d591c90/package.json#L826 not sure about their implementation. I will try to fix it and PR in their repo 👍

aralroca avatar Feb 17 '23 21:02 aralroca

I think this is the upstream issue:

  • https://github.com/lokalise/i18n-ally/issues/752

There is some precedent in the repo for fixing similar issues (see https://github.com/lokalise/i18n-ally/issues/307 ) so it would't be very hard, but the project seems to be abandoned 💀 since around October 2021 with no good fork that I could find.

Still a fix and PR would be great, but to publish it you'd likely need to publish a forked version. It would be great if you / someone did it, just wanted to share my research into the current state of things and what would it take to fix this issue.

By the way thanks @aralroca for all the the amazing work you're pouring into next-translate!

Update: there is a fork with getScopeRange configurable that may help to fix this issue with configuration-only. I haven't tested it yet. This is the fork and the merged PR that contains the potential fix:

  • https://github.com/aranard/i18n-ally/pull/1

cassus avatar Mar 04 '23 13:03 cassus

Hi guys, is there any other solution? maybe another VsCode extension?

AdamQuadmon avatar May 25 '23 05:05 AdamQuadmon