Discordコミュニティを作りました! 参加する

フォーラム

トピックを立てる前にチェック
  1. フォーラムガイドライン」に必ず目を通してください。
  2. バージョンアップデート後に表示がおかしくなった場合は、
    「SWELL設定」>「リセット」からキャッシュクリアを先にお試しください。
  3. フォーラム内検索で過去に同じようなトピックがないか検索してみてください。
翻譯Gutenbergブロック
 
通知
すべてクリア

翻譯Gutenbergブロック

8 投稿
4 ユーザー
3 Likes
625 表示
jason6666h
(@jason6666h)
投稿: 15
メンバー
Topic starter
 

こんにちは、私はちょうどあなたのテーマを購入し、英語と中国語にGutenbergブロックを翻訳する方法を知っていただきたいと思います、ありがとうございました。 (Loco translateで翻訳に失敗しました。)

確認項目
利用規約に同意します*, ガイドラインを読み、内容を把握しています*, よくある質問を先にチェック済みです*, 過去に同じようなトピックがないか検索済みです*, WordPress更新後、SWELLは最新版にしましたか?, Googleなどでも検索してみました, プラグインを停止しても同じことが起こることを確認しました, デフォルトテーマ等、他のテーマでも同じことが起こることを確認しました, 自分で追加したコードに問題がないかチェック済みです, サポート範囲外だということを理解しているが助けが欲しい(有料サポートしてくれる方を探したい)
問題が確認できるページのURL
利用中のSWELL本体のバージョン
2.6.4.2
利用中のPHPバージョン
7.4.0
OS
Windows
利用中のWordPressバージョン
6
利用中のサーバー会社
Oracle
ブラウザ
Chrome
利用中のプラグイン一覧

Loco translate

 
投稿済 : 15/06/2022 1:49 am
skillsharejp
(@skillsharejp)
投稿: 978
SWELL高速化顧問
 

You could use translation plugins like WPML, TranslatePress for contents. SWELL theme itself may not be fully translatable, but perhaps you could translate some strings with Loco Translate.

SWELLフォーラムはユーザーフォーラムのため、開発者以外の回答は全て任意です。当アカウントによる回答もボランティアのため、ヒントの提供に留まる場合があります。

ご依頼のご相談・お問い合わせ窓口
https://skillshare.biz/inquiry/

 
投稿済 : 15/06/2022 10:19 am
しらこ and suya reacted
jason6666h
(@jason6666h)
投稿: 15
メンバー
Topic starter
 

I just tried to use .po file to convert to json file through wp-cli, but the part of gutenberg block was not translated successfully, could you give me more tips?

I used the wp-cli command: wp i18n make-json po-filename.po --allow-root

 
投稿済 : 15/06/2022 6:53 pm
skillsharejp
(@skillsharejp)
投稿: 978
SWELL高速化顧問
 
投稿者:: @jason6666h

but the part of gutenberg block was not translated successfully,

Could you attach a screenshot mentioning which block and which part you are exactly referring to?

SWELLフォーラムはユーザーフォーラムのため、開発者以外の回答は全て任意です。当アカウントによる回答もボランティアのため、ヒントの提供に留まる場合があります。

ご依頼のご相談・お問い合わせ窓口
https://skillshare.biz/inquiry/

 
投稿済 : 15/06/2022 7:02 pm
jason6666h
(@jason6666h)
投稿: 15
メンバー
Topic starter
 

@skillsharejp This is the part I want to translate. 

Snipaste 2022 06 15 13 11 21

And I also found that when I use the command, 103 JSON files are generated, but I see that there is only one JSON file in the English translation. I don't know why this is happening.

This post was modified 2年前 by jason6666h
 
投稿済 : 15/06/2022 7:07 pm
了
 
(@loos_ryo)
投稿: 1248
メンバー Admin
 

Sorry, I have never used Loco Translate and I am not sure about the cause either.

I am not loading the translation files for the scripts for each block, only for 'swell_blocks' (/build/blocks/index.js).

This means that `wp_set_script_translations()` only needs to be done once.

SWELL開発者です。

 
投稿済 : 15/06/2022 8:59 pm
skillsharejp
(@skillsharejp)
投稿: 978
SWELL高速化顧問
 

Did you also check this stackoverflow answer?

https://stackoverflow.com/a/66381707

SWELLフォーラムはユーザーフォーラムのため、開発者以外の回答は全て任意です。当アカウントによる回答もボランティアのため、ヒントの提供に留まる場合があります。

ご依頼のご相談・お問い合わせ窓口
https://skillshare.biz/inquiry/

 
投稿済 : 16/06/2022 10:46 am
Tetsuaki Hamano
(@tetsuaki-hamano)
投稿: 19
メンバー
 

Hi @jason6666h,

Translation of Gutenberg blocks (JavaScript translation) is a mechanism introduced in WordPress 5.0. Therefore, translation will often be difficult with translation plugins. I also tried to translate using Loco Translate, but it did not work.

If you can run the npm command on your computer, the following method would be easiest. This is an example of generating a translation file in traditional Chinese.

  • Open the directory where you installed WordPress and go to `wp-content/themes/swell/languages`.
  • Copy `en_US.po` and create `zh_CN.po`.
  • Use this file for translation; you may want to use a tool such as Poedit.
  • Open a terminal and move to the `languages` directory.
    `cd /path/to/wp-content/themes/swell/languages`
  • Generate a JSON translation file for Gutenberg. Use npx and execute the following command:
    `npx po2json@1.0.0-beta-3 zh_CN.po swell-zh_CN-swell_blocks.json -f jed `
  • `swell-zh_CN-swell_blocks.json` file will be generated in the languages directory.
  • Change the site language to Traditional Chinese and confirm that the translation has been applied to the SWELL blocks.
 
投稿済 : 26/01/2023 7:37 pm
jason6666h reacted
共有: