Skip to content

Errors using make-json #146

@mkaz

Description

@mkaz

I'm trying to use the make-json command to generate the file from a po file.

Here are the set of commands I'm trying and the error, I think I'm missing a setting somewhere but not sure where.

> wp i18n make-post ./ ./languages/myguten.pot
Plugin file detected.
Success: POT file successfully generated!

I copy the .pot file over to myguten-eo.po and edit to look like:

# Copyright (C) 2019
# This file is distributed under the same license as the Scratch Plugin plugin.
msgid ""
msgstr ""
"Project-Id-Version: Scratch Plugin\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/scratch\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2019-02-18T07:20:46-08:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.1.0\n"
"X-Domain: myguten\n"

#. Plugin Name of the plugin
msgid "Scratch Plugin"
msgstr ""

#: block.js:6
msgid "Simple Block"
msgstr "Simpla bloko"

#: block.js:13
#: block.js:21
msgid "Hello World"
msgstr "Saltuon mundo"

I then try to make the json file using:

> wp i18n make-json ./languages
PHP Fatal error:  Uncaught InvalidArgumentException: The language "" is not valid in phar:///home/mkaz/bin/wp/vendor/gettext/gettext/src/Translations.php:356
Stack trace:
#0 phar:///home/mkaz/bin/wp/vendor/wp-cli/i18n-command/src/MakeJsonCommand.php(158): Gettext\Translations->setLanguage('')
#1 phar:///home/mkaz/bin/wp/vendor/wp-cli/i18n-command/src/MakeJsonCommand.php(97): WP_CLI\I18n\MakeJsonCommand->make_json('/home/mkaz/loca...', '/home/mkaz/loca...')
#2 [internal function]: WP_CLI\I18n\MakeJsonCommand->__invoke(Array, Array)
#3 phar:///home/mkaz/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(93): call_user_func(Array, Array, Array)
#4 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#5 phar:///home/mkaz/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(449): call_user_func(Object(Closure), Array, Array)
#6 phar:///home/mkaz/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(366): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
# in phar:///home/mkaz/bin/wp/vendor/gettext/gettext/src/Translations.php on line 356

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions