Skip to content

Spec: Introduce a mini-specification for localized resource use from JSON #5280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

DHowett-MSFT
Copy link
Contributor

Summary of the Pull Request

Pursuant to #4476, we may need to localize the name of the "cmd" profile.

References

#4476

@DHowett-MSFT
Copy link
Contributor Author

image

image

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Largely I'm okay with this since I already basically spec'd this in #2193, but let's make sure these discussions run their course

`wt -p profile`. I have no answer for how best to resolve this, except "get
used to it".

Since we also emit the name `cmd` in the user's settings template, we will want
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes I think a comment would probably be best here, I don't think we want to have to burden users with using the longer form in userDefaults. Esp. considering there's only 2 profiles in there by default, if they copy-pasta the cmd one, that might get really confusing.


```json
{
"name": { "resourceKey": "CommandPromptDisplayName" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want resourceKey or just key?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to key as it’s more concise


As above in Compatibility.

We need a fallback in case a resource cannot be found.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"name": { "key": "CmdDisplayName", "default": "cmd" }

maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about having a default. Things we specify should actually assert during DEBUG that they don’t exist, because it’s very important that we land all the resource keys right. Things the user specifies that don’t exist should return something like [KEY] so they can see the error of their ways.

Either way, I’ll include it in the spec


## Future considerations

If we allow the command palette's contents to be driven through JSON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DHowett-MSFT
Copy link
Contributor Author

I feel silly for having specced something you did already. I’m sorry about that. I couldn’t in truth remember if we landed on that discussion 😅

### Compatibility

A change in profile name, especially one that happens after the product ships
(due to a changing i18n setting on the system), will impact users accustomed to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Industry-accepted term for “Internationalization”

@carlos-zamora
Copy link
Member

I'm confused by something. So I'm just going to run through a scenario and you can correct me where I'm wrong.

  1. I'm in English-US locale
  2. I download Terminal
  3. When I open my defaults.json and settings.json, I literally see this...
"name": { "resourceKey": "CommandPromptDisplayName" }
  1. To use commandline args, I need to call wt -p "Command Prompt"
  2. I change my locale to Spanish-MX
  3. My defaults.json and settings.json are unchanged
  4. To use commandline args, I need to call wt -p "Command Prompt - Spanish Edition" (but like, with the actual localized string)

Separately, what I'm confused about is, can't we just use your %Version% code from before? Just add a %CmdName%, then replace it with a localized name? This would fail on everything past step 5, but is that an important scenario?

And we wouldn't have to worry about wt -p "<localized cmd name>" because we search through the profiles be a normal name, so that'd be ok?

@zadjii-msft
Copy link
Member

Separately, what I'm confused about is, can't we just use your %Version% code from before? Just add a %CmdName%, then replace it with a localized name?

I really like that. If we stamp the localized string straight into settings.json when it's generated, then it'll remain static unless the user changes it. So when they change to Spanish-MX, they'd still see "Command Prompt" as the name of the profile, unless they change it manually. If they delete their settings.json at this point, we'd regenerate the file with "El Command Prompto" (or whatever).

If we go ahead with having "name": { "resourceKey": "CommandPromptDisplayName" } in defaults.json (and a one-time generated name in settings.json), and the user removes the name of the profile from their settings.json, then they might get into a weird scenario where the profile name changes when they change the locale of their machine.

Alternatively we could just leave it as "name": "cmd" in defaults.json and it would work as an effective default value 🤔

@DHowett-MSFT
Copy link
Contributor Author

I’m more concerned about growing the manually-tended list of profile token replacements, if I’m honest. It’s fine for this one-off, but we do need a solution that’ll work for whatever other user-facing strings go in the settings file eventually. If consensus is that we should just do one more one time replacement, I’m down for that.

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Area-Settings Issues related to settings and customizability, for console or terminal Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs labels Apr 8, 2020
@DHowett-MSFT DHowett-MSFT deleted the dev/duhowett/spec/localization-json branch May 2, 2020 18:58
@DHowett-MSFT DHowett-MSFT restored the dev/duhowett/spec/localization-json branch May 2, 2020 18:58
@DHowett DHowett deleted the dev/duhowett/spec/localization-json branch October 26, 2021 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants