Spreadsheet Translations
This plugin enables non-developers to access static translations via a Google spreadsheet.
Requirements
This plugin requires Craft CMS 3.1.0 or later.
Installation
To install this plugin, follow these steps:
- Install with Composer via
internetztube/craft-spreadsheet-translations
- Install the plugin in the Craft Control Panel under Settings > Plugins You can also install this plugin via the Plugin Store in the Craft Control Panel.
Issues
Please report any issues you find to the Issues page.
Dynamic Strings
You CANNOT translate dynamic strings. Please use the message parameter.
{{ ("Welcome back, " ~ currentUser.friendlyName ~ "!") | t }}
{{ 'Welcome back, {name}!' | t(params = { name: currentUser.friendlyName}) }}
Only translations made in Twig with the
{{ "..." | t }}
-filter get pushed automatically into the spreadsheet.
Console Utilities
- Pulls all translations from the spreadsheet into static files on the disk. No handles get deleted!
php craft spreadsheet-translations/main/pull-translations
- Pushes all missing translation handles from the templates into the spreadsheet. No handles get deleted!
php craft spreadsheet-translations/main/push-missing-handles
- Pushes all missing site languages into the spreadsheet. No languages get deleted!
php craft spreadsheet-translations/main/push-missing-languages
These utilities are also available in the control panel in the Utilities section.
Setup / Settings
Google API
For this plugin a Google API token is mandatory. Here you will be shown how to create one.
- Go to https://console.developers.google.com/apis/library/sheets.googleapis.com.
- Click
ENABLE
. - Click
Credentials
in the sidebar. - Click
Create Credentials
and then selectService account key
. - Click
Select...
and create a new Service account or use an existing Service account. - Just fill in a name and an eMail prefix. You will need the eMail address in a further step.
- Keep
JSON
as Key type. - Click
Create
. - This Service account DOES NOT need a special role. So click
CREATE WITHOUT ROLE
in the modal. - A JSON file had been downloaded. The contents of this file must be copied to the
Contents of the access key file
-field in the plugin's settings. - Go to your Spreadsheet and share it with the eMail Address of the Service account.
Google Spreadsheets
In addition to the Contents of the access key file
, the Spreadsheet Id
and the Sheet Name where the Translations are located
is required in the settings.
Spreadsheet Id
The Spreadsheet Id is just a part of the URL.
https://docs.google.com/spreadsheets/d/<SPREADSHEET-ID>/edit
https://docs.google.com/spreadsheets/d/11fRj44MwhGqFGpIYHGfwpA69ed-Z657WdiXex6kvuo8/edit
-> 11fRj44MwhGqFGpIYHGfwpA69ed-Z657WdiXex6kvuo8
Sheet Name
This is the name of the sheet, where the translations are stored, which should be applied for this project. This string gets slugified. DEV: Translations
-> dev-translations
.
Brought to you by Frederic Köberl
Standard
Plus $5/year after one year.
To install this plugin, copy the command above to your terminal.
This plugin doesn't have any reviews.