triveon/translate-custom-variables

一个模块,用于在可翻译的CMS字符串中使用自定义变量

安装: 2

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:magento2-module

1.1.1 2024-02-23 12:31 UTC

This package is auto-updated.

Last update: 2024-09-23 14:23:41 UTC


README

这是官方的Translate Custom Variables Magento 2扩展。使用此模块,您可以在CMS元素的可翻译字符串中使用自定义变量。

它如何工作?

  1. 例如,您有一个自定义变量,代码为free_shipping_cost,您想在CMS块或CMS页面的可翻译字符串中放置它
  2. 为此,必须在翻译字符串中自定义变量代码之前放置前缀"customVar_"
  3. 如下:{{trans "Free Shipping from %free_shipping" free_shipping=customVar_free_shipping_cost}}

将用自定义变量free_shipping_cost的值替换%free_shipping。

安装

使用composer安装(推荐)

请使用SSH登录到您的环境。然后导航到Magento 2根目录,并按以下顺序运行以下命令

启用维护模式

php bin/magento maintenance:enable
  1. 安装扩展
composer require triveon/translate-custom-variables
  1. 启用Translate Custom Variables Magento 2插件
php bin/magento module:enable Triveon_TransCustomVars
  1. 更新Magento 2环境
php bin/magento setup:upgrade

当您的Magento环境在生产模式下运行时,您还需要运行以下命令

  1. 编译DI
php bin/magento setup:di:compile
  1. 部署静态内容
php bin/magento setup:static-content:deploy
  1. 禁用维护模式
php bin/magento maintenance:disable

手动安装

  1. 直接从github下载扩展,点击代码然后点击下载ZIP
  2. 创建目录app/code/Triveon/TransCustomVars(大小写敏感)
  3. 解压zip并将代码上传到app/code/Triveon/TransCustomVars
  4. 启用Translate Custom Vars Magento 2插件
php bin/magento module:enable Triveon_TransCustomVars
  1. 更新Magento 2环境
php bin/magento setup:upgrade

更新

要更新Translate Custom Variables扩展,请运行以下命令

composer update triveon/translate-custom-variables
php bin/magento setup:upgrade