1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 16:49:41 +00:00

chore: auto format code

This commit is contained in:
Tw93
2025-12-17 02:37:33 +00:00
parent be1027f9c3
commit 3053e05ce4
2 changed files with 5 additions and 5 deletions

View File

@@ -253,7 +253,7 @@ get_brand_name() {
# Detect if system primary language is Chinese
local is_chinese=false
local sys_lang
sys_lang=$(defaults read -g AppleLanguages 2>/dev/null | grep -o 'zh-Hans\|zh-Hant\|zh' | head -1 || echo "")
sys_lang=$(defaults read -g AppleLanguages 2> /dev/null | grep -o 'zh-Hans\|zh-Hant\|zh' | head -1 || echo "")
[[ -n "$sys_lang" ]] && is_chinese=true
# Return localized names based on system language

View File

@@ -49,7 +49,7 @@ for char in s:
else:
width += 1
print(width)
" "$str" 2>/dev/null && return
" "$str" 2> /dev/null && return
fi
# Fallback: Use wc with UTF-8 locale temporarily
@@ -60,8 +60,8 @@ print(width)
export LANG=en_US.UTF-8
local char_count byte_count width
char_count=$(printf '%s' "$str" | wc -m 2>/dev/null | tr -d ' ')
byte_count=$(printf '%s' "$str" | wc -c 2>/dev/null | tr -d ' ')
char_count=$(printf '%s' "$str" | wc -m 2> /dev/null | tr -d ' ')
byte_count=$(printf '%s' "$str" | wc -c 2> /dev/null | tr -d ' ')
# Restore locale
if [[ -n "$saved_lc_all" ]]; then
@@ -127,7 +127,7 @@ for char in s:
width += char_width
print(result + '...')
" "$str" "$max_width" 2>/dev/null && return
" "$str" "$max_width" 2> /dev/null && return
fi
# Fallback: Use UTF-8 locale for proper string handling