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

Proposal for additional settings/features #9

Closed
mk-dev-1 opened this issue May 27, 2021 · 2 comments
Closed

Proposal for additional settings/features #9

mk-dev-1 opened this issue May 27, 2021 · 2 comments

Comments

@mk-dev-1
Copy link

Hi there,

the plugin is already very helpful, however I would like to propose the following additional features:

1. Allow for input file name customization

Currently the plugin is looking for en.json only. It would be great to customize this as my files have a intl_ in front of it.

2. Allow for input file extension customization

Currently the plugin is looking for json only. It would be great to customize this as my files are ending in arb, which is essentially a json file.

3. Add filter options

Currently the plugin is looking for translating each and every string, but I would like to be able to define filters so that some strings to not get translated. Particularly, some of my strings look like this "@testString": {...}. I would like to filter out everything starting with @.

Do you think there is a chance to get this implemented?

@SamHasler
Copy link

SamHasler commented Jan 12, 2022

Regarding point 1. We use filenames with country codes in them.
e.g.:

en-GB.json
en-US.json
fr-FR.json
fr-CA.json

could either the filename pattern be somehow deduced from the current filename, or it be made configurable in some way. I would also expect to have to change the default locale to en-GB so it knows which english file to use, so perhaps that's all that it needs to switch to a different pattern?

Google doesn't support country codes
https://cloud.google.com/translate/docs/languages
(see also #6)

but the extension now also supports AWS and Azure and they do (e.g. both support fr-CA, but the call fr-FR just "fr"
https://docs.aws.amazon.com/translate/latest/dg/what-is.html#language-pairs
https://docs.microsoft.com/en-us/azure/cognitive-services/translator/language-support

So we will probably need to maintain a list of what languages each service supports (unless there's some way to query for it?) and handle mapping filenames to the most appropriate language code.

For en-GB to en-US (or the reverse) it would be nice if it just copies the original file without translating, but if that was the only one I had to do by hand it wouldn't be ok.


Just in case anyone else is searching for it. If the extension doesn't understand your filename format you will see this error:

[Window Title]
Visual Studio Code

[Content]
Command 'Auto Translate JSON' resulted in an error (Cannot read property 'fsPath' of undefined)

[OK]

image

@topce
Copy link
Collaborator

topce commented May 18, 2023

  1. is done could use new option ignorePrefix
    other do not plan to do

@topce topce closed this as completed May 18, 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

3 participants