pot-cutfn
v1.0.2
Published
Remove the file name from the POT file.
Readme
How to use?
When localizing the WordPress block editor during development, if there is multiple file information when converting a POT file created with make-pot using make-json, multiple JSON files will be created. By setting the file information to a single file name (dummy) when creating the POT, you can create a single JSON file.
WordPress ブロックエディタの開発においてローカライズを行うとき、 make-potで作成したPOTファイルをmake-jsonで変換する時にファイル情報が複数あるとその分JSONが作成されてしまいます。 POTを作成した時点でファイル情報を単一のファイル名(ダミー)にすることで一つのJSONファイルを作成できるようになります。
Precautions
In this example, we convert the .po file, but in reality you should convert it at the .pot stage. It would be inefficient to do this for each translation.
ここの使用例では.poファイルを変換してますが、実際には.potの段階で変換してください。 翻訳毎にこの作業を行うのは非効率です。
Issues with make-json
#: src/kurage/edit.tsx:132
msgid "Control Panel"
msgstr "コントロールパネル"
#: src/kurage/edit.tsx:135
msgid "Settings Panel"
msgstr "設定パネル"
#: src/kurage/context/markdown-app-context.tsx:170
msgid "Loading settings information..."
msgstr "設定情報を読み込んでいます..."
#: src/kurage/components/inspector-hooks.tsx:117
msgid "Text Update"
msgstr "テキスト更新"- This example only shows a few of them, but there are actually many more.
- ここの例では一部しか載せてませんが、実際はもっとあります。
make-jsonします。
wp i18n make-json languages/markdown-block-editor-ja.po languages/po --no-purge --extensions=ts,tsx
edit.tsx, markdown-app-context.tsx, inspector-hooks.tsx, but there are actually more, so JSON files will be created for each.
edit.tsx, markdown-app-context.tsx, inspector-hooks.tsx、実際にはもっとあるのでJSONファイルがその分出来上がってしまいます。
Replace the file information with dummy information.
pot-cutfn from.po --filename build/index.jsReplaces filenames from POT files with a single dummy filename,
POファイルからファイル名を単一のダミーファイル名に置き換えます。
#: build/index.js
msgid "Control Panel"
msgstr "コントロールパネル"
#: build/index.js
msgid "Settings Panel"
msgstr "設定パネル"
#: build/index.js
msgid "Loading settings information..."
msgstr "設定情報を読み込んでいます..."
#: build/index.js
msgid "Text Update"
msgstr "テキスト更新"wp i18n make-json languages/markdown-block-editor-ja.po languages/po --no-purgeIf make-json creates a single JSON file, it's a success.
make-jsonの実行で単一のJSONファイルが作成されていれば成功です。
- If everything is converted to index.js, you don't need --extensions.
- index.jsにすべて変換されていれば、--extensionsは必要ありません。
Why use a dummy filename instead of deleting it? If you don't specify a filename, make-json will ignore it.
何故削除じゃなくてダミーのファイル名にする? ファイル名を指定しないとmake-jsonに無視されるからです。
basic
pot-cutfn from.poThis is not recommended.
Replace the file information in from.po with index.js.
これを使うのは非推奨。
from.po内のファイル情報をindex.jsに置き換えます。
replace
pot-cutfn from.po --to to.poThe --to option creates a new file, which is safer because if there is a bug in the program, the original file will remain.
--to オプションは新たにファイルを作成します。このプログラムにバグがあった場合、元のファイルが残るのでこちらが安全です。
file name
pot-cutfn from.po --to to.po --filename build/index.jsThe --filename option specifies a dummy filename.
The default is index.js.
--filename オプションはファイル名のダミーを指定します。
デフォルトはindex.jsです。
