Skip to content

I18n fixes#211

Merged
sawka merged 6 commits intomainfrom
i18n-fixes
Jan 9, 2024
Merged

I18n fixes#211
sawka merged 6 commits intomainfrom
i18n-fixes

Conversation

@oneirocosm
Copy link
Contributor

This change addresses several issues around internationalization support. These changes fix issues #88 and #190 as well as improving some additional areas not discussed in those.

The first and most important is that it removes a filter used to sanitize json bytes prior to serializing them. This was removing non-ascii characters which broke commands containing non-ascii code.

The next change is fixing a couple instances in the frontend where atob and btoa were misused. Those functions don't work as expected, so they have been replaced with the base64-js library to handle the conversion. Note that this library was previously included as a dependency to another dependency in use, but it has been added to package.json to make that explicit.

There is another small dead code removal in the frontend for a utility function that is never used.

Lastly, this adds the ability to detect the locale of the OS and use it within waveterm. This is specifically required to show characters properly when they are in the filesystem. This locale is converted into a LANG variable and shared with the remote you are using to ensure both are in agreement. That said, I do have some concerns around a few areas of this. For one, it may be possible that multilingual users expect to have different locales on different remotes. Additionally, it does appear to be possible to set different locales to be used with different programs, but we don't support that currently. I think this is acceptable in the meantime, but these could become issues further down the line.

When serializing jsonBytes in packet.go::MarshalPacket, a step existed
that attempted to manually sanitize the bytes before sending them. This
was initially done to avoid invalid characters in json; however, go
should handle this for us. But this sanitization broke
internationalization because it excluded characters required for unicode
in other languages. Because of that, it has been removed.
The functions atob and btoa do not convert base 64 to strings in the
expected way. The base64ToArray function handles it properly but other
cases do not. These other cases have been replaced with a helper
function that makes use of the base64-js package. This package has
already been included as a dependency of another package we use, but it
was added to the package.json file to make the inclusion explicit.
Waveterm previously did not set the LANG environment variable which
caused problems for international users. On Linux, this is done
automatically, but it needs to be done manually on macos.

Even on linux, the wavesrv LANG variable is shared with waveshell to
ensure the same one is used on remotes.
In order to prevent waveterm from overriding the lang var entirely, this
ensures that it is only manually determined if it hasn't previously been
set.
This is slightly more performant and relies more directly on our code
instead of external code.
@sawka sawka merged commit e1e5b67 into main Jan 9, 2024
@sawka sawka deleted the i18n-fixes branch February 16, 2024 00:06
xxyy2024 pushed a commit to xxyy2024/waveterm_aipy that referenced this pull request Jun 24, 2025
Bumps the dev-dependencies group with 3 updates:
[tsx](https://github.com/privatenumber/tsx),
[vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) and
[vite-tsconfig-paths](https://github.com/aleclarson/vite-tsconfig-paths).

Updates `tsx` from 4.16.5 to 4.17.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/privatenumber/tsx/releases">tsx's
releases</a>.</em></p>
<blockquote>
<h2>v4.17.0</h2>
<h1><a
href="https://github.com/privatenumber/tsx/compare/v4.16.5...v4.17.0">4.17.0</a>
(2024-08-08)</h1>
<h3>Features</h3>
<ul>
<li>upgrade esbuild to 0.23 (<a
href="https://redirect.github.com/privatenumber/tsx/issues/615">#615</a>)
(<a
href="https://github.com/privatenumber/tsx/commit/bd83d3bf59e39767ec64eec86fe5b48a8e50b991">bd83d3b</a>)</li>
</ul>
<hr />
<p>This release is also available on:</p>
<ul>
<li><a href="https://www.npmjs.com/package/tsx/v/4.17.0"><code>npm
package (@​latest dist-tag)</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/privatenumber/tsx/commit/bd83d3bf59e39767ec64eec86fe5b48a8e50b991"><code>bd83d3b</code></a>
feat: upgrade esbuild to 0.23 (<a
href="https://redirect.github.com/privatenumber/tsx/issues/615">#615</a>)</li>
<li>See full diff in <a
href="https://github.com/privatenumber/tsx/compare/v4.16.5...v4.17.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `vite` from 5.3.5 to 5.4.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vitejs/vite/releases">vite's
releases</a>.</em></p>
<blockquote>
<h2>create-vite@5.4.0</h2>
<p>Please refer to <a
href="https://github.com/vitejs/vite/blob/create-vite@5.4.0/packages/create-vite/CHANGELOG.md">CHANGELOG.md</a>
for details.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md">vite's
changelog</a>.</em></p>
<blockquote>
<h2>5.4.0 (2024-08-07)</h2>
<ul>
<li>fix(build): windows platform build output path error (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17818">#17818</a>)
(<a
href="https://github.com/vitejs/vite/commit/6ae0615416762dd1b89393316308cf8edf115c34">6ae0615</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17818">#17818</a></li>
<li>fix(deps): update launch-editor to consume fix for windows paths (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17828">#17828</a>)
(<a
href="https://github.com/vitejs/vite/commit/cf2f90d4b9f9b16b8009b0f9d0d9f7e71e98c54d">cf2f90d</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17828">#17828</a></li>
<li>fix(ssr): fix <code>global</code> variable name conflict (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17809">#17809</a>)
(<a
href="https://github.com/vitejs/vite/commit/6aa220607b4f5457c1ef9ff68d75885a9abbdaf6">6aa2206</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17809">#17809</a></li>
<li>fix(worker): fix <code>importScripts</code> injection breaking iife
code (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17827">#17827</a>)
(<a
href="https://github.com/vitejs/vite/commit/bb4ba9f448da01782f585369f80c4517da087000">bb4ba9f</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17827">#17827</a></li>
<li>chore: bump typescript-eslint to v8 (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17624">#17624</a>)
(<a
href="https://github.com/vitejs/vite/commit/d1891fda026d27f53409dec97e156a59da609196">d1891fd</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17624">#17624</a></li>
<li>chore(deps): update all non-major dependencies (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17820">#17820</a>)
(<a
href="https://github.com/vitejs/vite/commit/bb2f8bb55fdd64e4f16831ff98921c221a5e734a">bb2f8bb</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17820">#17820</a></li>
<li>perf(ssr): do a single-pass over AST with node cache arrays (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17812">#17812</a>)
(<a
href="https://github.com/vitejs/vite/commit/81327eb980c308474a586a9cb9c0c5fff10eba34">81327eb</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17812">#17812</a></li>
</ul>
<h2>5.4.0-beta.1 (2024-08-01)</h2>
<ul>
<li>fix: handle encoded base paths (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17577">#17577</a>)
(<a
href="https://github.com/vitejs/vite/commit/720447ee725046323387f661341d44e2ad390f41">720447e</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17577">#17577</a></li>
<li>fix: opt-in server.fs.cachedChecks (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17807">#17807</a>)
(<a
href="https://github.com/vitejs/vite/commit/4de659c351589b83a83a7a42f3da5b071a625662">4de659c</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17807">#17807</a></li>
<li>feat(css): support sass compiler api and sass-embedded package (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17754">#17754</a>)
(<a
href="https://github.com/vitejs/vite/commit/1025bb6d8f21c0cb9fe72405d42e0f91bb3f1d8e">1025bb6</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17754">#17754</a></li>
</ul>
<h2>5.4.0-beta.0 (2024-07-30)</h2>
<ul>
<li>fix: specify own Node version as target when bundling config files
(<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17307">#17307</a>)
(<a
href="https://github.com/vitejs/vite/commit/bbf001f0ecb4e9b826bbeb75b91d39f20aab3142">bbf001f</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17307">#17307</a></li>
<li>fix(build): handle invalid JSON in import.meta.env (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17648">#17648</a>)
(<a
href="https://github.com/vitejs/vite/commit/659b7206930d660779ad504beef89744fb97d339">659b720</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17648">#17648</a></li>
<li>fix(deps): update all non-major dependencies (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17780">#17780</a>)
(<a
href="https://github.com/vitejs/vite/commit/e408542748edebd93dba07f21e3fd107725cadca">e408542</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17780">#17780</a></li>
<li>fix(mergeConfig): don't recreate server.hmr.server instance (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17763">#17763</a>)
(<a
href="https://github.com/vitejs/vite/commit/5c55b291cf1d41664b0e949acf41d70c956659da">5c55b29</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17763">#17763</a></li>
<li>feat(css): support sass modern api (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17728">#17728</a>)
(<a
href="https://github.com/vitejs/vite/commit/73a3de01d2baaeefeabfa46c28fb49550643b23a">73a3de0</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17728">#17728</a></li>
<li>feat(types): support custom VitePreloadErrorEvent (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17615">#17615</a>)
(<a
href="https://github.com/vitejs/vite/commit/116e37acf1a9ce808bc7a7f3a1439ab749c168e3">116e37a</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17615">#17615</a></li>
<li>perf: improve regex performance (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17789">#17789</a>)
(<a
href="https://github.com/vitejs/vite/commit/952bae3efcbd871fc3df5b1947060de7ebdafa36">952bae3</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17789">#17789</a></li>
<li>chore: minor config.logger refactor (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17770">#17770</a>)
(<a
href="https://github.com/vitejs/vite/commit/b947fdcc9d0db51ee6ac64d9712e8f04077280a7">b947fdc</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17770">#17770</a></li>
<li>chore: update eslint config (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17788">#17788</a>)
(<a
href="https://github.com/vitejs/vite/commit/796eef3af1291facc47b5273f83b0ef16d6d76b7">796eef3</a>),
closes <a
href="https://redirect.github.com/vitejs/vite/issues/17788">#17788</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vitejs/vite/commit/7c06ef07f835308b1ff2de3df02d201a8dbfb3b6"><code>7c06ef0</code></a>
refactor(optimizer): use early continues (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17551">#17551</a>)</li>
<li><a
href="https://github.com/vitejs/vite/commit/a8e2f6fafcf106ccc0d5a46972e66c2bf73155e3"><code>a8e2f6f</code></a>
fix(client): uniform variable <code>location</code> (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17528">#17528</a>)</li>
<li><a
href="https://github.com/vitejs/vite/commit/6c106622812480d2bb134f8ed8efa84e2eb942c4"><code>6c10662</code></a>
chore(deps): update dependency eslint to v9 (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/16661">#16661</a>)</li>
<li><a
href="https://github.com/vitejs/vite/commit/bf123f2c6242424a3648cf9234281fd9ff44e3d5"><code>bf123f2</code></a>
fix(deps): update all non-major dependencies (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17494">#17494</a>)</li>
<li><a
href="https://github.com/vitejs/vite/commit/ec16a5efc04d8ab50301d184c20e7bd0c8d8f6a2"><code>ec16a5e</code></a>
chore: fix some comments (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17495">#17495</a>)</li>
<li><a
href="https://github.com/vitejs/vite/commit/c608e6ac740509c2e68a6928d84676878a998dd0"><code>c608e6a</code></a>
release: v5.3.1</li>
<li><a
href="https://github.com/vitejs/vite/commit/6ced135c6fc9367f8d4f8207666e208f90547af5"><code>6ced135</code></a>
fix(build): preload treeshaking ignore equal (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17480">#17480</a>)</li>
<li><a
href="https://github.com/vitejs/vite/commit/d355568e8d2dbc30b94b7d7680943f7db713ddc4"><code>d355568</code></a>
fix(build): handle preload treeshaking for braces (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17479">#17479</a>)</li>
<li><a
href="https://github.com/vitejs/vite/commit/1f09344b57b253c0435290de1d6e147c8c9b50d5"><code>1f09344</code></a>
chore: consolidate changelog for 5.3 (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17476">#17476</a>)</li>
<li><a
href="https://github.com/vitejs/vite/commit/3e2707122033a5be074d88dbeb244526dee85bb9"><code>3e27071</code></a>
fix(build): handle preload treeshaking for commas (<a
href="https://github.com/vitejs/vite/tree/HEAD/packages/vite/issues/17472">#17472</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vitejs/vite/commits/create-vite@5.4.0/packages/vite">compare
view</a></li>
</ul>
</details>
<br />

Updates `vite-tsconfig-paths` from 4.3.2 to 5.0.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/aleclarson/vite-tsconfig-paths/releases">vite-tsconfig-paths's
releases</a>.</em></p>
<blockquote>
<h2>v5.0.0</h2>
<p>This package is now ESM only in order to align with Vite: <a
href="https://vitejs.dev/guide/migration#deprecate-cjs-node-api">https://vitejs.dev/guide/migration#deprecate-cjs-node-api</a></p>
<p>If your project is using CommonJS, you can rename your Vite config to
use the <code>.mjs</code> or <code>.mts</code> extension (depending on
whether you use TypeScript or not). If you're not using Vite v5.0.0+,
you may want to pin your dependency to v4 of this plugin.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/aleclarson/vite-tsconfig-paths/commit/c2b0b4ca111cf01453dbf7fe80fdc49e5526c46e"><code>c2b0b4c</code></a>
5.0.1</li>
<li><a
href="https://github.com/aleclarson/vite-tsconfig-paths/commit/ae80736bf5e2029900c0518416681e006b1b56ca"><code>ae80736</code></a>
chore(fix): restore &quot;main&quot; and &quot;types&quot; fields in
package.json</li>
<li><a
href="https://github.com/aleclarson/vite-tsconfig-paths/commit/29093ed6c869741f1e7e5241fdfedc2d1d44d5a2"><code>29093ed</code></a>
5.0.0</li>
<li><a
href="https://github.com/aleclarson/vite-tsconfig-paths/commit/66d478e8e66f72dd3c41ef3a53febe27955445f4"><code>66d478e</code></a>
chore: update readme notice</li>
<li><a
href="https://github.com/aleclarson/vite-tsconfig-paths/commit/5ff0d6abbae3f98276f4460b34478e02d7ef98a2"><code>5ff0d6a</code></a>
chore: drop CJS build (<a
href="https://redirect.github.com/aleclarson/vite-tsconfig-paths/issues/151">#151</a>)</li>
<li><a
href="https://github.com/aleclarson/vite-tsconfig-paths/commit/03ffe4a60afd40066cdbd0048dce853084e2e4a2"><code>03ffe4a</code></a>
chore: update readme announcement</li>
<li><a
href="https://github.com/aleclarson/vite-tsconfig-paths/commit/fc2da504bfec1ed6ae5caad3d65efa7a9b1bbb20"><code>fc2da50</code></a>
chore: update lockfiles</li>
<li>See full diff in <a
href="https://github.com/aleclarson/vite-tsconfig-paths/compare/v4.3.2...v5.0.1">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants