Skip to content
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

"Session contents restored…" date shown in US format #136855

Closed
krzysztofjeziorny opened this issue Nov 10, 2021 · 9 comments
Closed

"Session contents restored…" date shown in US format #136855

krzysztofjeziorny opened this issue Nov 10, 2021 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders l10n-platform Localization platform issues (not wrong translations) terminal-persistence Relating to process reconnection or process revive verified Verification succeeded
Milestone

Comments

@krzysztofjeziorny
Copy link

krzysztofjeziorny commented Nov 10, 2021

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.62.1
  • OS Version: MacOS 11.6.1

Steps to Reproduce:

  1. open the integrated terminal
  2. quit VSCode
  3. launch VSCode again
  4. the "Session contents restored from" shows the date in US format ("11/5/2021 at 1:10:47 PM") ignoring the OS's region settings (Austria in my case, with UK English set as user's language)
  5. changing the user's language (i.e. to German to reflect the region) doesn't fix the format, just changes the language of the message ("Sitzungsinhalte aus 11/10/2021 um 1:26:09 PM wiederhergestellt")

Screenshot 2021-11-10 at 11 57 57

@meganrogge meganrogge added the terminal-persistence Relating to process reconnection or process revive label Nov 10, 2021
@stacklast
Copy link

I have the same Issue:

  • Windows 11 Home
    • Version: 21H2
    • Compilation: 22000.318
  • VS Code Version: 1.62.1

The same steps to reproduce.

@Tyriar Tyriar added the polish Cleanup and polish issue label Nov 12, 2021
@Tyriar Tyriar added this to the November 2021 milestone Nov 12, 2021
@Tyriar
Copy link
Member

Tyriar commented Nov 12, 2021

Hmm this is actually already using locale to string, I guess that means Electron's locale isn't set based on the system 🤔

}, "Session contents restored from {0} at {1}", new Date(state.timestamp).toLocaleDateString(), new Date(state.timestamp).toLocaleTimeString());

@Tyriar
Copy link
Member

Tyriar commented Nov 12, 2021

This is working fine for me on Windows:

image
image

@Tyriar
Copy link
Member

Tyriar commented Nov 12, 2021

I can reproduce on macOS despite having Australia set in Region and "locale": "en-gb" in runtime arguments. @deepak1556 @TylerLeonhardt any idea why Date.toLocaleDateString isn't respecting the locale on mac?

@Tyriar Tyriar added l10n-platform Localization platform issues (not wrong translations) bug Issue identified by VS Code Team member as probable bug and removed polish Cleanup and polish issue labels Nov 12, 2021
@Tyriar Tyriar modified the milestones: November 2021, Backlog Nov 29, 2021
@deepak1556
Copy link
Collaborator

@Tyriar this issue might have the same root cause as #85675, locale being broken in ELECTRON_RUN_AS_NODE processes.

@Tyriar
Copy link
Member

Tyriar commented Dec 6, 2021

@deepak1556 ah ok this makes sense as the date is formatted on the pty host. We might be able to format the date on the renderer to work around this.

@Tyriar Tyriar modified the milestones: Backlog, December 2021 Dec 6, 2021
@Tyriar
Copy link
Member

Tyriar commented Dec 6, 2021

Actually, let's pass the locale over from the renderer process when reviving processes:

async reviveTerminalProcesses(state: string) {
const parsedUnknown = JSON.parse(state);
if (!('version' in parsedUnknown) || !('state' in parsedUnknown) || !Array.isArray(parsedUnknown.state)) {
this._logService.warn('Could not revive serialized processes, wrong format', parsedUnknown);
return;
}
const parsedCrossVersion = parsedUnknown as ICrossVersionSerializedTerminalState;
if (parsedCrossVersion.version !== 1) {
this._logService.warn(`Could not revive serialized processes, wrong version "${parsedCrossVersion.version}"`, parsedCrossVersion);
return;
}
const parsed = parsedCrossVersion.state as ISerializedTerminalState[];
for (const state of parsed) {
const restoreMessage = localize({
key: 'terminal-session-restore',
comment: ['date the snapshot was taken', 'time the snapshot was taken']
}, "Session contents restored from {0} at {1}", new Date(state.timestamp).toLocaleDateString(), new Date(state.timestamp).toLocaleTimeString());

@Tyriar Tyriar closed this as completed in 9fca35e Dec 6, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 20, 2022
@rzhao271 rzhao271 added verified Verification succeeded and removed verified Verification succeeded labels Jan 27, 2022
@JacksonKearl
Copy link
Contributor

verified, only the most recent message has "hot swapping", but I think that's roughly expected.

image

@JacksonKearl JacksonKearl added the verified Verification succeeded label Jan 28, 2022
@Tyriar
Copy link
Member

Tyriar commented Jan 28, 2022

Yep after it's written to the terminal it's fixed text and won't change just like the rest of the buffer

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders l10n-platform Localization platform issues (not wrong translations) terminal-persistence Relating to process reconnection or process revive verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

8 participants
@krzysztofjeziorny @deepak1556 @Tyriar @rzhao271 @JacksonKearl @stacklast @meganrogge and others