定制 internetztube/craft-spreadsheet-translations 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

internetztube/craft-spreadsheet-translations

Composer 安装命令:

composer require internetztube/craft-spreadsheet-translations

包简介

Adds support for dynamic translations from Google Spreadsheets.

README 文档

README

This plugin enables non-developers to access static translations via a Google spreadsheet.

Share Image

Screenshots

Sample Spreadsheet Translation Files Utilities Settings

Requirements

This plugin requires Craft CMS 5.0.0 or later.

Installation

To install this plugin, follow these steps:

  1. Install with Composer via internetztube/craft-spreadsheet-translations
  2. Install 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}) }}
    

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
    
    ⚠️ Make sure there is an translations/<lang>/site.php present! Otherwise, no translations get pulled from templates!
  • 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.

  1. Go to https://console.developers.google.com/apis/library/sheets.googleapis.com.
  2. Click ENABLE.
  3. Click Credentials in the sidebar.
  4. Click Create Credentials and then select Service account key.
  5. Click Select... and create a new Service account or use an existing Service account.
  6. Just fill in a name and an eMail prefix. You will need the eMail address in a further step.
  7. Keep JSON as Key type.
  8. Click Create.
  9. This Service account DOES NOT need a special role. So click CREATE WITHOUT ROLE in the modal.
  10. 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.
  11. 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.

Brought to you by Frederic Köberl

统计信息

  • 总下载量: 625
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固