Package: i18nconverter
i18n-json-spreadsheetLazy i18n json to spreadsheet and back tool.The aim of this utility is to help the management of JSON translations
file used for example in JS frontends to handle locales.Usually we can have key/value items nested in some way like the following:{"hello":"ciao","how_are_you":"come stai","component_a":{"my_name_is":"il mio nome é"}}To avoid editors to edit JSON files directly, ofted in git repos, the idea is
to create/update online spreadsheet on Google Docs and maybe Microsoft Office 365.InstallationPIPThe package is available onPypi. To install locally on a virtual env or globally execute a standard package installation:❯pipinstalli18nconverterAuthenticationAt the moment we support only Service Account file to authenticate API for Google Drive and Google Spreadsheet. To get you SA file you have to:VisitGoogle Developers Consoleto create a new projectIn the input box "Search for APIs and Services" search forGoogle Drive APIand check it.Repeat forGoogle Sheets APICreate and download the key file followinghttps://cloud.google.com/iam/docs/keys-create-deleteQuickstartMove to your current project directory and configure the environment❯i18nconverterinit
📝Creatinglocalconfiguration...
↳GCPServiceAccountJSONfilelocation?:/tmp/my-sa-file.json
↳GoogleSpreadsheetlink?:NA
↳Howdoyoumanagelocalecodes?↳[1]indifferentfiles↳[2]onthefirstlevelofJSON[1]:

🎉Configurationfilecreated.i18nconverter.jsonSince we're going to create a new file we can insert a random string toGoogle Spreadsheet link?question.Then we can create the new spreadsheet where manage translations❯i18nconvertercreate--name"MY_PROJECT_Translations"--owner"john.doe@none.com"--save
📝Creatingnewspreadsheet"MY_PROJECT_Translations"...
https://docs.google.com/spreadsheets/d/99999-8
✅Configfileupdated.Create entries to the previously created Google Spreadsheet for italian using dedicated sheet namedit-IT.❯i18nconvertertogdoc-ipublic/locales/it-IT/translation.json--sheetIT--create-sheet
✅Updatecompleted.
💻Checkathttps://docs.google.com/spreadsheets/d/99999-8Then repeat foren-USlocale.❯i18nconvertertogdoc-ipublic/locales/en-US/translation.json--sheeten-US--create-sheet
✅Updatecompleted.
💻Checkathttps://docs.google.com/spreadsheets/d/99999-8Fill some translations on Google DocsUpdate local JSON file❯i18nconvertertojson-opublic/locales/it-IT/translation.json-sit-ITCheck differences locally maybe with the help ofgit diffHow toThis tool is intended to be used as CLI tool.Get help❯i18nconverter--help
Usage:i18nconverter[OPTIONS]COMMAND[ARGS]...

Options:--authTEXTServiceAccountJSONfilepath--silentSilentmode:questionstouserwillbeskipped(ignoredforsetup)--helpShowthismessageandexit.

Commands:inittogdoctojsontokvCreate local permantent config fileTo simplify the frequent usage we support a local configuration file that will be searchedonly in the current directory.❯i18nconverterinit
📝Creatinglocalconfiguration...
↳GCPServiceAccountJSONfilelocation?:/tmp/my-sa-file.json
↳GoogleSpreadsheetlink?:https://docs.google.com/spreadsheets/d/ffa9a9f99f
↳Howdoyoumanagelocalecodes?↳[1]indifferentfiles↳[2]onthefirstlevelofJSON[1]:1🎉Configurationfilecreated.i18nconverter.jsonAs you can see a file in the same directory called.i18nconverter.jsonwill be created and you can skip setting SA file path and source/target spreadsheet link on each command.Json To Google Spreadsheet❯i18nconvertertogdoc--help
Usage:i18nconvertertogdoc[OPTIONS]Options:-i,--infileTEXTJSONinputfile-ol,--outlinkTEXTDestinationlinkforGoogleSpreadsheet-s,--sheetTEXTDestinationsheetinGoogleSpreadsheet-o,--overwriteClearworksheetbeforewritingvalues--create-sheet/--no-create-sheetCreatenewsheetwithgivennameifitnotexists--helpShowthismessageandexit.Google Spreadsheet to Json file❯i18nconvertertojson--help
Usage:i18nconvertertojson[OPTIONS]Options:-o,--outfileTEXTJSONoutputfile-il,--inlinkTEXTSourcelinkforGoogleSpreadsheet--start-cellTEXTStartreadingfromthiscellcoordinates-s,--sheetTEXTSourcesheetinGoogleSpreadsheet--helpShowthismessageandexit.Compare Json file and Google Spreadsheet❯i18nconvertercompare--help
Usage:i18nconvertercompare[OPTIONS]Options:-f,--fileTEXTJSONfileforcomparison[required]-l,--linkTEXTLinktoGoogleSpreadsheet-s,--sheetTEXTSourcesheetinGoogleSpreadsheet-c,--columnINTEGERColumtoreadinGoogleSpreadsheet--helpShowthismessageandexit.The response will show two csv with differences:❯i18nconvertercompare-f/tmp/somefile.json
KeyspresentinGoogleSpreadsheetandnotpresentinJSON:actions.addedaaa
KeyspresentinJSONandnotpresentinGoogleSpreadsheet:actions.added