microsoft / vscode-l10n

MIT License
66 stars 14 forks source link

Multiple target languages doesn't work on Ubuntu #163

Open PeterWone opened 8 months ago

PeterWone commented 8 months ago

All of these commands work fine on Windows

npx @vscode/l10n-dev generate-azure -o ./l10n/ ./l10n/bundle.l10n.json ./package.nls.json
npx @vscode/l10n-dev generate-azure -o ./l10n/ ./l10n/bundle.l10n.json ./package.nls.json --debug -l zh-Hans -l ja -l es -l ru -l pt-br -l fr -l ko -l zh-Hant -l it -l pl -l hu -l cs -l bg -l tr -l my -l ca -l lt -l hy
npx @vscode/l10n-dev generate-azure -o ./l10n/ ./l10n/bundle.l10n.json ./package.nls.json --debug -l zh-Hans ja es ru pt-br fr ko zh-Hant it pl hu cs bg tr my ca lt hy

On Ubuntu they report this

Searching for L10N JSON files...
  DEBUG Localizing data using Azure... +0ms
vscode-l10n-dev generate-azure [args] <path..>

(Experimental) Generate language files for `*.l10n.json` or `package.nls.json`
files. You must create an Azure Translator instance, get the key and region, and
set the AZURE_TRANSLATOR_KEY and AZURE_TRANSLATOR_REGION environment variables
to these values.

Positionals:
  path  L10N JSON files to generate an XLF from. Supports folders and glob
        patterns.                               [array] [required] [default: []]

Options:
      --version    Show version number                                 [boolean]
  -v, --verbose    Enable verbose logging                              [boolean]
  -d, --debug      Enable debug logging                                [boolean]
      --help       Show help                                           [boolean]
  -l, --languages  The Pseudo language identifier that will be used.
                                                               [array] [default:
    ["fr","it","de","es","ru","zh-cn","zh-tw","ja","ko","cs","pt-br","tr","pl"]]

At first I thought it was a wrong path or permissions or something in the GitHub workflow I was changing but I can reproduce this interactively on Ubuntu (yay remote workspaces!) which is how I discovered it also occurs when you don't specify target languages and default to the core 10.

This works fine on Ubuntu

npx @vscode/l10n-dev export --outDir ./l10n ./src
PeterWone commented 8 months ago

I cloned this repo and followed the build instructions on Ubuntu without any reported exceptions (yes I built the tree-sitter first) but now it's borked on my ubuntu system and of course I wasn't smart enough to do this in a container. Now trying to use it produces

Error: bad export type for `tree_sitter_tsx_external_scanner_create`: undefined
    at reportUndefinedSymbols (/home/peter/.npm/_npx/68546583dcb2c24b/node_modules/web-tree-sitter/tree-sitter.js:1:19748)
    at postInstantiation (/home/peter/.npm/_npx/68546583dcb2c24b/node_modules/web-tree-sitter/tree-sitter.js:1:17027)
    at /home/peter/.npm/_npx/68546583dcb2c24b/node_modules/web-tree-sitter/tree-sitter.js:1:17752
    at async /home/peter/.npm/_npx/68546583dcb2c24b/node_modules/@vscode/l10n-dev/dist/cli.js:343:10
    at async /home/peter/.npm/_npx/68546583dcb2c24b/node_modules/@vscode/l10n-dev/dist/cli.js:332:22

which is probably my fault but it's been a long day so I give up.

PeterWone commented 8 months ago

Might be environmental (env vars), switched github workflow to use windows and same thing

PeterWone commented 8 months ago

OK embarrassing. westus region should have been westus2. The error could be more helpful if you can detect rejected credentials.

But building it has borked things for me on Ubuntu, any advice on cleaning that up?

TylerLeonhardt commented 8 months ago

What version of Node are you using? I think you wanna make sure to have Node 18

PeterWone commented 8 months ago

node v20.11.1 npm 10.2.4

should I take it back to 18?

TylerLeonhardt commented 8 months ago

Yeah, the Node20 bug is: https://github.com/microsoft/vscode-l10n/issues/114