oblik/kirby-memsource

Kirby integration for the Phrase (formerly Memsource) TMS service.

2.0.0 2022-10-06 15:28 UTC

This package is auto-updated.

Last update: 2024-12-27 09:40:01 UTC


README

Memsource integration for Kirby

This plugin allows you to translate your entire site content in the powerful TMS Memsource:

  • Create Memsource jobs with great control over what's exported
  • Import Memsource jobs with reports for what has changed
  • Great control over the exported format of fields via kirby-walker
  • Support for the Kirby Editor

Note: Currently does not support Kirby 3.6 and above.

Installation

With Composer from oblik/kirby-memsource on Packagist:

composer require oblik/kirby-memsource

Sign up for a developer account in Memsource.

Context notes

You can specify comments to aid translators by adding them in the blueprint:

fields:
    heading:
        type: text
        memsource:
            note: This is the title of the page.

When exported, the JSON will look like this:

{
    "pages": {
        "home": {
            "heading": {
                "$value": "Hello World!",
                "$note": "This is the title of the page."
            }
        }
    }
}

Then, you can configure Memsource's context note functionality to trigger on $note keys.

Settings

You can configure the plugin in your site/config.php:

return [
    'oblik.memsource' => [
        // settingsā€¦
    ]
];

Credentials

Add your Memsource account credentials:

return [
    'oblik.memsource' => [
        'login' => [
            'username' => 'john',
            'password' => '1234'
        ]
    ]
];

Remove <br> tags

You might want to put <br> to force text to break at specific positions in order to achieve a certain layout effect. This is pretty much impossible to be achieved in translations because the text will have different word length and overall length.

For this reason, you might want to remove <br> tags from your exports:

return [
    'oblik.memsource' => [
        'walker' => [
            'removeBrTags' => true
        ]
    ]
];

Dynamic context notes

You may generate context notes on the fly:

return [
    'oblik.memsource' => [
        'walker' => [
            'contextNote' => function ($value) {
                if (strpos($value, '{{ year }}') !== false) {
                    return "{{ year }} is the current calendar year.";
                }
            }
        ]
    ]
];