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

Google Translate with Google Sheets #6

Open
LiamKarlMitchell opened this issue Dec 4, 2021 · 5 comments
Open

Google Translate with Google Sheets #6

LiamKarlMitchell opened this issue Dec 4, 2021 · 5 comments

Comments

@LiamKarlMitchell
Copy link

Found a nice way to populate the translations quickly using Google Translate via Google Sheets.

Language codes can be found here.
https://cloud.google.com/translate/docs/languages

The formula entered into a new Locale column you want to add to your translations sheet.

=GOOGLETRANSLATE(cell with text, “source language”, “target language”)
such as
=GOOGLETRANSLATE($B2,"en","fr")

Then you can drag the formula down all the cells.

image

Then you can File | Download | CSV and replace the one in your project file and generate as normal.

@dannyconnell
Copy link
Owner

@LiamKarlMitchell wow thanks that's really helpful! I'm definitely gonna use this on Fudget 2.
@fabform thanks! I wonder if there's a way we can use this to automatically download the sheet as CSV (with an npm package or something) ...

@dannyconnell
Copy link
Owner

@LiamKarlMitchell we can also use an if statement to check that the source field is not blank before we do the translation, so that we can avoid errors on blank lines (if, for example we're separating different sections with blank lines and comments, as below):

Screenshot 2022-01-10 at 14 10 23

@LiamKarlMitchell
Copy link
Author

Yeah, google sheet works great, just need to automate download from it.
If better translations are made then can just update them later, of course be careful who writes in your translations if it is going in v-html etc.

@LiamKarlMitchell
Copy link
Author

Thanks for your Quasar videos btw @dannyconnell

@LiamKarlMitchell
Copy link
Author

LiamKarlMitchell commented May 1, 2022

Formula with check for not empty.
=IF($B3<>"",GOOGLETRANSLATE($B3, "en", "fr"),"")

Also you can download CSV automagically.

I was considering extending the watcher command to have an optional -gs googlesheeturl that it could poll for difference.
As an HTTP HEAD request doesn't show any kind of e-tag or version identifier sadly can only do a checksum to a temp file and over-write previous translation.csv if different as the watcher check looks at a timestamp.

If you make a google sheet public for anyone with url can view.

URL to download a google sheet looks like.
https://docs.google.com/spreadsheets/d/{DocumentId}/gviz/tq?tqx=out:csv&sheet={SheetName}

Or rather than extending for now, maybe I'de just make an accompanying script that does the download and re-executes quasalang seems to work well enough.

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
@LiamKarlMitchell @dannyconnell and others