Skip to content

Commit 29e276e

Browse files
committed
stash
1 parent edf31d1 commit 29e276e

30 files changed

+423
-190
lines changed

locales/en-US.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"ask_self_update": "a newer version of manager has been found: %{latest}\ncurrently running: %{current}\ndo you wish to update now?",
88
"ask_toolkit_update": "a newer version of toolkit has been found: %{latest}\ncurrently installed: %{current}\ndo you wish to update now?",
99
"ask_uninstall_option": "Choose an uninstall option",
10+
"auto_check_manager_updates": "Auto-Check for Manager Updates",
11+
"auto_check_toolkit_updates": "Auto-Check for Toolkit Updates",
1012
"back": "Back",
13+
"beta": "Beta",
1114
"bin_crate": "binary crate",
1215
"bin_crate_help": "binary crates are source code that can be compiled to executable binary, and can also be managed using `cargo` install or uninstall.",
1316
"cancel": "Cancel",
@@ -55,6 +58,7 @@
5558
"fetch_latest_toolkit_version_failed": "unable to retrieve information about the latest toolkit version",
5659
"fetching": "fetching",
5760
"finish": "Finish",
61+
"general": "General",
5862
"handling_extension_info": "%{op}ing extension '%{ext}' for program '%{program}'",
5963
"insecure_download": "skipping SSL certificate verification (requested by `--insecure` flag)",
6064
"insecure_http_override": "using 'http' schema to skip SSL certificate verification (requested by `--insecure` flag)",
@@ -84,13 +88,15 @@
8488
"integers": "integers",
8589
"invalid_components": "invalid component(s): %{list}",
8690
"invalid_input": "Invalid input '%{actual}', expecting %{expect}, please try again",
91+
"language": "Language",
8792
"latest_manager_installed": "already running on the latest release version (%{version}), no need to update",
8893
"latest_toolkit_installed": "already installed the latest toolkit (%{name}-%{version}), no need to update",
8994
"license_agreement": "License Agreement",
9095
"linux_source_hint": "Environment changes require restarting opened shells or run `%{cmd}` to take effect.",
9196
"list_of_ids": "space separated integers less than %{bound}",
9297
"list_option": "List component/toolkit",
9398
"loading_archive_info": "extracting %{kind} archive '%{path}'",
99+
"manager_update_channel": "Manager Update Channel",
94100
"minimal": "Minimal",
95101
"minimal_desc": "Contains only the required components sufficient to run Rust compiler, no other tools such as IDE are included",
96102
"missing_restricted_source": "pacakge source of tool '%{name}' is restricted, which should be provided by user or has a default value, but none of those are presented",
@@ -171,6 +177,7 @@
171177
"skip_version": "Skip This Version",
172178
"source_configuration": "Source Configuration",
173179
"space_separated_and": "space separated ",
180+
"stable": "Stable",
174181
"standalone_tool": "standalone tool",
175182
"standalone_tool_help": "standalone tool has it's own `bin` directory, which contains a bunch of executables that will be automatically added to the PATH.",
176183
"standard": "Standard",

locales/zh-CN.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"ask_self_update": "检测到最新管理器版本: %{latest}\n当前运行版本: %{current}\n是否现在更新?",
88
"ask_toolkit_update": "检测到最新开发套件版本: %{latest}\n当前已安装: %{current}\n是否现在更新?",
99
"ask_uninstall_option": "卸载选项",
10+
"auto_check_manager_updates": "自动检查此管理器更新",
11+
"auto_check_toolkit_updates": "自动检查工具套件更新",
1012
"back": "返回",
13+
"beta": "Beta",
1114
"bin_crate": "二进制crate",
1215
"bin_crate_help": "二进制crate是可以编译成可执行二进制文件的源代码,也可以通过`cargo` install或uninstall进行管理。",
1316
"cancel": "取消",
@@ -55,6 +58,7 @@
5558
"fetch_latest_toolkit_version_failed": "无法获取最新工具套件版本",
5659
"fetching": "正在获取",
5760
"finish": "完成",
61+
"general": "通用",
5862
"handling_extension_info": "正在%{op} '%{program}' 的以下插件: '%{ext}'",
5963
"insecure_download": "跳过 SSL 证书验证(根据命令行选项 'insecure' 的要求)",
6064
"insecure_http_override": "使用 “http” 跳过 SSL 证书验证(根据命令行选项 'insecure' 的要求)",
@@ -84,13 +88,15 @@
8488
"integers": "整数",
8589
"invalid_components": "无效组件: %{list}",
8690
"invalid_input": "无效的输入 '%{actual}',正确格式应为%{expect},请重试",
91+
"language": "语言",
8792
"latest_manager_installed": "当前管理工具已经是最新版本 (%{version}), 无需更新",
8893
"latest_toolkit_installed": "已安装最新版本工具套件 (%{name}-%{version}), 无需更新",
8994
"license_agreement": "许可协议",
9095
"linux_source_hint": "环境变量更改后需要重启已打开的 Shell 或运行 `%{cmd}` 命令才能生效。",
9196
"list_of_ids": "小于 %{bound} 的空格分隔整数序列",
9297
"list_option": "显示组件/套件列表",
9398
"loading_archive_info": "正在提取 %{kind} 压缩包 '%{path}'",
99+
"manager_update_channel": "管理器更新频道",
94100
"minimal": "精简版",
95101
"minimal_desc": "仅包含运行 Rust 编译器所需的最基础组件,不包含集成开发环境等非必需工具",
96102
"missing_restricted_source": "工具 '%{name}' 的安装包来源受限制,必须由用户明确提供或应具有默认值,但目前既未提供来源,也未设置默认值。",
@@ -171,6 +177,7 @@
171177
"skip_version": "跳过此版本",
172178
"source_configuration": "下载源配置",
173179
"space_separated_and": "使用空格分隔并且",
180+
"stable": "稳定版",
174181
"standalone_tool": "独立工具",
175182
"standalone_tool_help": "独立工具拥有自己的`bin`目录,其中包含一系列可执行文件,这些文件将自动添加到PATH环境变量中。",
176183
"standard": "标准版",

rim_common/src/types/configuration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl Configuration {
6464
setter!(set_language(self.language, Option<Language>));
6565
}
6666

67-
#[derive(Debug, Deserialize, Serialize, Default, PartialEq, Eq)]
67+
#[derive(Debug, Deserialize, Serialize, Default, PartialEq, Eq, Clone, Copy)]
6868
#[non_exhaustive]
6969
pub enum Language {
7070
CN,

rim_common/src/utils/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub use progress_bar::*;
1919
use std::{
2020
ffi::OsStr,
2121
path::{Path, PathBuf},
22-
str::FromStr,
2322
sync::{LazyLock, Mutex},
2423
time::Duration,
2524
};
@@ -29,7 +28,7 @@ use url::Url;
2928

3029
use crate::types::{Configuration, Language};
3130

32-
static CURRENT_LOCALE: LazyLock<Mutex<String>> = LazyLock::new(|| Mutex::new(String::new()));
31+
static CURRENT_LOCALE: LazyLock<Mutex<Language>> = LazyLock::new(|| Mutex::new(Language::EN));
3332

3433
/// Insert a `.exe` postfix to given input.
3534
///
@@ -193,42 +192,43 @@ pub fn to_string_lossy<S: AsRef<OsStr>>(s: S) -> String {
193192

194193
/// Use configured locale or detect system's current locale.
195194
pub fn use_current_locale() {
196-
set_locale(&get_locale());
195+
set_locale(get_locale());
197196
}
198197

199198
/// Getting the current locale by:
200199
/// 1. Checking RIM configuration file, return the configured language if has.
201200
/// 2. Check system's current locale using [`sys_locale`] crate.
202201
/// 3. Fallback to english locale.
203-
pub fn get_locale() -> String {
202+
pub fn get_locale() -> Language {
204203
Configuration::try_load_from_config_dir()
205204
.and_then(|c| c.language)
206-
.map(|lang| lang.locale_str().to_string())
207-
.or_else(|| sys_locale::get_locale())
208-
.unwrap_or_else(|| Language::EN.locale_str().to_string())
205+
.or_else(|| sys_locale::get_locale().and_then(|s| s.parse().ok()))
206+
.unwrap_or_default()
209207
}
210208

211-
pub fn set_locale(loc: &str) {
209+
pub fn set_locale(lang: Language) {
210+
let loc = lang.locale_str();
212211
rust_i18n::set_locale(loc);
213212

214213
// update the current locale
215-
*CURRENT_LOCALE.lock().unwrap() = loc.to_string();
216-
// update persistant locale config, but don't fail the program,
214+
*CURRENT_LOCALE.lock().unwrap() = lang;
215+
// update persistent locale config, but don't fail the program,
217216
// because locale setting is not that critical.
218217
let set_locale_inner_ = || -> Result<()> {
219218
Configuration::load_from_config_dir()
220-
.set_language(Some(Language::from_str(loc)?))
219+
.set_language(Some(lang))
221220
.write()
222221
};
223222
if let Err(e) = set_locale_inner_() {
224223
error!("unable to save locale settings after changing to '{loc}': {e}");
225224
}
225+
debug!("locale successfully set to: {loc}");
226226
}
227227

228228
/// Get the configured locale string from `configuration.toml`
229229
pub fn build_cfg_locale(key: &str) -> &str {
230230
let cur_locale = &*CURRENT_LOCALE.lock().unwrap();
231-
crate::cfg_locale!(cur_locale, key)
231+
crate::cfg_locale!(cur_locale.locale_str(), key)
232232
}
233233

234234
/// Waits until `duration` has elapsed.

rim_gui/src-tauri/src/common.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,13 @@ pub(crate) fn supported_languages() -> Vec<Language> {
192192

193193
#[tauri::command]
194194
pub(crate) fn set_locale(language: String) -> Result<()> {
195-
let lang: DisplayLanguage = language.parse()?;
196-
utils::set_locale(lang.locale_str());
195+
utils::set_locale(language.parse()?);
197196
Ok(())
198197
}
199198

200199
#[tauri::command]
201200
pub(crate) fn get_locale() -> String {
202-
utils::get_locale()
201+
utils::get_locale().locale_str().into()
203202
}
204203

205204
#[tauri::command]

rim_gui/src/components/BaseCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const props = defineProps({
2020
background: rgba(255, 255, 255, .1);
2121
border: 2px solid transparent;
2222
box-shadow: 0 0 0 2px rgba(255, 255, 255, .6), 0 16px 32px rgba(0, 0, 0, .12);
23-
backdrop-filter: url(#frosted);
23+
backdrop-filter: blur(25px);
2424
-webkit-backdrop-filter: blur(25px);
2525
outline: 0;
2626
}
Lines changed: 56 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<script setup lang="ts">
2-
const { title, hint, disabled, isGroup, labelComponent, labelComponentProps } = defineProps<{
2+
const { title, hint, disabled, isGroup, labelComponent, labelComponentProps, labelAlignment } = defineProps<{
33
title?: string;
44
hint?: string;
55
disabled?: boolean;
66
isGroup?: boolean;
77
labelComponent?: Object;
88
labelComponentProps?: Object;
9+
labelAlignment?: 'right' | 'left';
910
}>();
1011
1112
const emit = defineEmits(['titleClick']);
@@ -22,48 +23,77 @@ const toggleCheck = () => {
2223
</script>
2324

2425
<template>
25-
<label flex="inline items-center" :class="disabled ? 'c-disabled' : 'c-regular'" :title="hint || title" cursor-pointer>
26-
<span class="checkbox"
27-
:class="{
28-
'c-active': isGroup,
29-
'bg-active border-active': isChecked,
30-
'bg-disabled-bg': disabled,
31-
'hover:b-active': !disabled,
32-
'cursor-not-allowed': disabled,
33-
}" @click="toggleCheck">
34-
<slot name="icon">
35-
<i class="i-mdi:check" v-if="isChecked" c="active" />
36-
</slot>
37-
</span>
38-
<span @click="emit('titleClick')" whitespace-nowrap>
39-
<slot>
40-
<component v-if="labelComponent" :is="labelComponent" v-bind="labelComponentProps" />
41-
<span :class="isGroup ? 'cb-label-group' : 'cb-label'" v-else>{{ title }}</span>
42-
</slot>
43-
</span>
26+
<label class="checkbox-wrapper" :class="disabled ? 'c-disabled' : 'c-regular'" :title="hint || title">
27+
<template v-if="labelAlignment === 'left'">
28+
<span @click="emit('titleClick')" whitespace-nowrap>
29+
<slot>
30+
<component v-if="labelComponent" :is="labelComponent" v-bind="labelComponentProps" />
31+
<span :class="isGroup ? 'cb-label-group' : 'cb-label'" v-else>{{ title }}</span>
32+
</slot>
33+
</span>
34+
<span class="checkbox"
35+
:class="{
36+
'c-active': isGroup,
37+
'bg-active border-active': isChecked,
38+
'bg-disabled-bg': disabled,
39+
'hover:b-active': !disabled,
40+
'cursor-not-allowed': disabled,
41+
}" @click="toggleCheck">
42+
<slot name="icon">
43+
<i class="i-mdi:check" v-if="isChecked" c="active" />
44+
</slot>
45+
</span>
46+
</template>
47+
48+
<template v-else>
49+
<span class="checkbox"
50+
:class="{
51+
'c-active': isGroup,
52+
'bg-active border-active': isChecked,
53+
'bg-disabled-bg': disabled,
54+
'hover:b-active': !disabled,
55+
'cursor-not-allowed': disabled,
56+
}" @click="toggleCheck">
57+
<slot name="icon">
58+
<i class="i-mdi:check" v-if="isChecked" c="active" />
59+
</slot>
60+
</span>
61+
<span @click="emit('titleClick')" whitespace-nowrap>
62+
<slot>
63+
<component v-if="labelComponent" :is="labelComponent" v-bind="labelComponentProps" />
64+
<span :class="isGroup ? 'cb-label-group' : 'cb-label'" v-else>{{ title }}</span>
65+
</slot>
66+
</span>
67+
</template>
4468
</label>
4569
</template>
4670

4771
<style lang="css" scoped>
72+
.checkbox-wrapper {
73+
display: flex;
74+
align-items: center;
75+
gap: clamp(6px, 4%, 2rem);
76+
}
77+
4878
.checkbox {
49-
/** flex="~ items-center justify-center" h="1rem" w="1rem" b="1px solid base" shrink="0" rounded="3px" bg="white" */
5079
display: flex;
5180
align-items: center;
5281
justify-content: center;
53-
min-width: 1rem;
54-
min-height: 1rem;
82+
min-width: 1.5vw;
83+
min-height: 1.5vw;
84+
margin-block: 0.5vh;
5585
background: white;
5686
border: 2px solid rgb(204, 204, 204);
5787
border-radius: 3px;
58-
margin-right: clamp(6px, 4%, 2rem);
88+
cursor: pointer;
5989
}
6090
.cb-label {
6191
font-weight: 500;
62-
font-size: clamp(0.5rem, 2.6vh, 1.5rem);
92+
font-size: clamp(0.5rem, 2.5vh, 1.5rem);
6393
}
6494
.cb-label-group {
6595
--uno: 'c-active';
6696
font-weight: bold;
67-
font-size: clamp(0.5rem, 2.7vh, 1.5rem);
97+
font-size: clamp(0.5rem, 2.6vh, 1.5rem);
6898
}
6999
</style>

rim_gui/src/components/BasePanel.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ const emit = defineEmits(['close']);
3737
left: 0;
3838
width: 100vw;
3939
height: 100vh;
40-
backdrop-filter: url(#frosted);
40+
backdrop-filter: blur(25px);
4141
-webkit-backdrop-filter: blur(25px);
4242
display: flex;
4343
justify-content: center;
4444
align-items: center;
45+
z-index: 999;
4546
}
4647
4748
.panel-content {

rim_gui/src/components/BaseProgress.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function progressFormat(value: number) {
2929
overflow: hidden;
3030
background: rgba(255, 255, 255, .4);
3131
box-shadow: 0 0 0 2px rgba(255, 255, 255, .6), 0 16px 32px rgba(0, 0, 0, .12);
32-
backdrop-filter: url(#frosted);
32+
backdrop-filter: blur(25px);
3333
-webkit-backdrop-filter: blur(25px);
3434
outline: 0;
3535
}

rim_gui/src/components/BaseRadioGroup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const alignmentClass = computed(() => `align-${props.alignment}`);
8787
border-radius: 4px;
8888
font-size: 12px;
8989
white-space: nowrap;
90-
z-index: 100;
90+
z-index: 999;
9191
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
9292
pointer-events: none;
9393
}

0 commit comments

Comments
 (0)