Skip to content

Feature Request: Leverage the data cascade for per-page contextual localisations #23

@chriskirknielsen

Description

@chriskirknielsen

Hi there,

I like this plugin but ran into issues: I wanted to be able to add localised strings from context.
My reasoning behind not adding those strings into a global data file for each language is that longform content is a bit of a pain to organise.

For example, if a layout page (say your typical /about/ page) that needs a particular string localised that isn't within the content itself but a component outside the main layout, you might not want to have all that stuff in your en.json file and whatnot. By adding the translation within the page itself, you can keep your page's localised content contained within the same file. A minor convenience but in my case, it makes a lot of sense.

I have worked this idea into PR #24, let me know what you think.

Note that I nested the additional data under page to prevent key collisions. Prefixing with an underscore or setting a plugin option to a specific key might be a better idea, but keeping it simple for now.

I hope this all make sense, and I can provide a more fleshed out example if interested!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions