Skip to content

Cookiecutter localization of additional metadata #1758

@huguesv

Description

@huguesv

The additional Label and Description fields that we can specify in our custom _visual_studio section are for the UI, so it would be best if we had the ability to localize them if the author of the template wishes to do so.

PTVS users are used to everything being in English, but if we want to convince other teams to adopt cookiecutter...

If we wanted to have separate files for each language, that could be a reason to move that data out of cookiecutter.json and make the format change now.

If we don't want to worry about this now, I think we can keep our existing format to work with multiple languages later.

For example:

    "_visual_studio": {
        "project_name": {
            "label": "Project Name",
            "description": "Full project name."
        },
        "use_azure": {
            "label": "Use Azure",
            "description": "Microsoft Azure Support",
            "selector": "yesno"
        }
    }

Could be updated to:

    "_visual_studio": {
        "project_name": {
            "label": "Project Name",
            "label-fr": "Nom de Project",
            "label-fr-fr": "Nom de Project",
            "description": "Full project name."
            "description-fr": "Nom complet du project."
        },
        "use_azure": {
            "label": "Use Azure",
            "description": "Microsoft Azure Support",
            "selector": "yesno"
        }
    }

And the loading code just needs to be changed to fetch the label and description in this order of priority:

  • "label-{language}-{region}"
  • "label-{language}"
  • "label"

It may not be as convenient for translators that need to work in parallel (multiple files win), but maybe it's good enough.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions