Skip to content

Translatable Blueprints #3120

@adamziel

Description

@adamziel

How could one create an i18n-friendly Blueprint that creates a site equally friendly to French, English, German, Polish etc. audiences?

It could be solved at the Blueprint schema level. However, localizing may involve translating the content, using different images, setting dedicated site options etc. That sounds more like a completely separate Blueprint than a schema change.

Perhaps the solution is then a Blueprint meta-tool that reconciles a Blueprint template with a set of inputs and produces a localized input? It's similar to Helm and Kubernetes situation.

For example, this could be a blueprint.template.json

{
  "meta": {
    "parameters": {
      "locale": {
        "required": true,
        "type": "string"
      },
      "strings": {
        "type": "object"
      },
      "assets": {
        "type": "object"
      }
    }
  },
  "steps": [
    {
      "setSiteOptions": {
        "WPLANG": "{{ locale }}",
        "blogname": "{{ strings.site_title }}",
        "blogdescription": "{{ strings.site_tagline }}"
      }
    },
    {
      "createPost": {
        "postType": "page",
        "slug": "home",
        "title": "{{ strings.home_title }}",
        "content": "{{ strings.home_content }}",
        "featuredImage": "{{ assets.home_hero }}"
      }
    }
  ]
}

And this could be a blueprint-fr.input.json

{
  "locale": "fr_FR",
  "strings": {
    "site_title": "Mon site",
    "site_tagline": "Un exemple multilingue",
    "home_title": "Accueil",
    "home_content": "<p>Bienvenue sur le site.</p>"
  },
  "assets": {
    "home_hero": "./images/fr/home.jpg"
  }
}

And the tool would accept both of these, and create a final Blueprint.

This could also support additional steps from @akirk's https://akirk.github.io/playground-step-library/. Perhaps it could even be a way of supporting a Blueprint v2 schema with a v1 runtime?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions