{
  "landingPage": "/glotpress/projects/twentytwentyfour/",
  "preferredVersions": {
    "php": "8.0",
    "wp": "latest"
  },
  "steps": [
    {
      "step": "login",
      "username": "admin",
      "password": "password"
    },
    {
      "step": "setSiteOptions",
      "options": {
        "permalink_structure": "/%year%/%monthnum%/%day%/%postname%/"
      }
    },
    {
      "step": "writeFile",
      "path": "/wordpress/wp-content/mu-plugins/gp-sqlite.php",
      "data": "<?php add_filter( 'query', function( $query ) {return str_replace( ' BINARY ', ' ', $query );} );if ( ! function_exists( 'libxml_clear_errors' ) ) {function libxml_clear_errors() {}}if ( ! function_exists( 'libxml_use_internal_errors' ) ) {function libxml_use_internal_errors() {}}if ( ! function_exists( 'libxml_get_errors' ) ) {function libxml_get_errors() {}}if ( ! function_exists( 'mysql_get_client_info' ) ) {function mysql_get_client_info() {}}if ( ! function_exists( 'mb_str_split' ) ) {function mb_str_split(  $string = '', $length = 1 , $encoding = null ){return str_split( $string, $length );}}if ( ! class_exists( 'DOMDocument' ) ) {class DOMDocument {function loadHTML() {}}}"
    },
    {
      "step": "installPlugin",
      "pluginZipFile": {
        "resource": "wordpress.org/plugins",
        "slug": "glotpress"
      }
    },
    {
      "step": "mkdir",
      "path": "/wordpress/wp-content/downloads/"
    },
    {
      "step": "writeFile",
      "path": "/wordpress/wp-content/downloads/twentytwentyfour_DE_translations.zip",
      "data": {
        "resource": "url",
        "caption": "Downloading zip file",
        "url": "https://downloads.wordpress.org/translation/theme/twentytwentyfour/1.0/de_DE.zip"
      }
    },
    {
      "step": "writeFile",
      "path": "/wordpress/wp-content/downloads/twentytwentyfour_FR_translations.zip",
      "data": {
        "resource": "url",
        "caption": "Downloading zip file",
        "url": "https://downloads.wordpress.org/translation/theme/twentytwentyfour/1.0/fr_FR.zip"
      }
    },
    {
      "step": "writeFile",
      "path": "/wordpress/wp-content/downloads/twentytwentyfour_ES_translations.zip",
      "data": {
        "resource": "url",
        "caption": "Downloading zip file",
        "url": "https://downloads.wordpress.org/translation/theme/twentytwentyfour/1.0/es_ES.zip"
      }
    },
    {
      "step": "unzip",
      "zipPath": "/wordpress/wp-content/downloads/twentytwentyfour_DE_translations.zip",
      "extractToPath": "/wordpress/wp-content/languages/themes"
    },
    {
      "step": "unzip",
      "zipPath": "/wordpress/wp-content/downloads/twentytwentyfour_FR_translations.zip",
      "extractToPath": "/wordpress/wp-content/languages/themes"
    },
    {
      "step": "unzip",
      "zipPath": "/wordpress/wp-content/downloads/twentytwentyfour_ES_translations.zip",
      "extractToPath": "/wordpress/wp-content/languages/themes"
    },
    {
      "step": "runPHP",
      "code": "<?php include 'wordpress/wp-load.php'; require_once ABSPATH . 'wp-admin/includes/upgrade.php';require_once GP_PATH . GP_INC . 'install-upgrade.php'; require_once GP_PATH . GP_INC . 'schema.php';gp_upgrade_db();set_current_user( 1 ); GP::$administrator_permission->create( array( 'user_id' => 1, 'action' => 'admin', 'object_type' => null, ));function translation_import_overrides( $fields ) { if ( ! empty( $fields['warnings'] ) ) { unset( $fields['warnings'] ); $fields['status'] = 'current'; } unset( $fields['user_id'] ); return $fields; } $new_project = new GP_Project( array( 'name' => 'Twenty Twenty-Four', 'slug' => 'twentytwentyfour','path' => 'twentytwentyfour', 'description' => 'Welcome to this GlotPress demo inside WordPress Playground!' . PHP_EOL . 'This is a GlotPress project of the Twenty Twenty-Four theme where we loaded a few languages from https://translate.wordpress.org/projects/wp-themes/twentytwentyfour/.' . PHP_EOL . 'Here, you can experiment with the GlotPress UI and how to do translations. Since this is a sandbox, you can submit any fake translations or reject correc translations, just to see how things work.' . PHP_EOL . 'We have also given you administrative priviledges, so you can create new projects and translation sets and so on.' . PHP_EOL . 'Happy exploring!', 'active' => true ));$project = GP::$project->create_and_select( $new_project ); foreach( array( 'de_DE', 'es_ES', 'fr_FR', 'hi_IN', 'ko_KR' ) as $lang ) { $locale = GP_Locales::by_field( 'wp_locale', $lang ); $new_set = new GP_Translation_Set( array( 'name' => $locale->english_name, 'slug' => 'default', 'project_id' => $project->id, 'locale' => $locale->slug ) ); $translation_set = GP::$translation_set->create_and_select( $new_set ); $local_mo = '/wordpress/wp-content/languages/themes/twentytwentyfour-' . $lang . '.mo'; $format = 'mo'; $format = gp_array_get( GP::$formats, $format, null ); $originals = $format->read_originals_from_file( $local_mo, $project ); $originals = GP::$original->import_for_project( $project, $originals ); $mo = new MO(); $mo->import_from_file( $local_mo ); add_filter( 'gp_translation_prepare_for_save', 'translation_import_overrides' ); $translation_set->import( $mo, 'current' ); }",
      "progress": {
        "caption": "Making theme translatable"
      }
    }
  ]
}
