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

Allow changing source language #14

Open
Demian101 opened this issue Oct 16, 2023 · 2 comments
Open

Allow changing source language #14

Demian101 opened this issue Oct 16, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Demian101
Copy link

Demian101 commented Oct 16, 2023

My need is to translate Chinese mdbook files into English.
Now I have created en.po and am ready to use cloud-translate to translate it into English.

but! At this point call the cloud-translate command:

$ cloud-translate [my-project-ID] po/en.po 10000

I ran into a problem where the source_language defaulted to English and I didn't know how to change it to Chinese


Error info:

$ cloud-translate red-bruin-402208 po/en.po 100

Stopping translation at message 1: 邱奇-图灵(Church-Turing)
Translating 1 messages into en
Error: could not deserialize: {
  "error": {
    "code": 400,
    "message": "Target language can't be equal to source language.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "source_language_code",
            "description": "Source language: en_US"
          },
          {
            "field": "target_language_code",
            "description": "Target language: en"
          }
        ]
      }
    ]
  }
}


Caused by:
    missing field `translations` at line 22 column 1

grateful !

@Demian101
Copy link
Author

Oh, i solved it by compiling it locally..

@mgeisler mgeisler reopened this Oct 16, 2023
@mgeisler mgeisler added the enhancement New feature or request label Oct 16, 2023
@mgeisler
Copy link
Owner

Hey @Demian101, actually... this is something we should support!

We need to make the source language here a parameter of the translate function:

let request = TranslateTextRequest {
contents: msgids.into(),
mime_type: "text/plain",
source_language_code: "en_US",
target_language_code: lang,
};

and then somehow pass in this parameter.

@mgeisler mgeisler added help wanted Extra attention is needed good first issue Good for newcomers labels Oct 16, 2023
@mgeisler mgeisler changed the title Change cloud-translate source language Allow changing source language Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants