fix: use awk for locale-independent cost formatting#1
Open
dzhavoronkov wants to merge 1 commit into
Open
Conversation
The bash printf with LC_NUMERIC=C was ignored on Russian locale systems, causing comma decimal separator (0,00) which triggered fallback output, resulting in duplicated output like $0,00$0.00. awk with LC_ALL=C reliably formats numbers with period decimal separator regardless of system locale. --- Исправлено форматирование стоимости для русской локали. Проблема: bash printf игнорировал LC_NUMERIC=C на русской системе, выводя запятую (0,00), что вызывало срабатывание fallback и дублирование вывода вида $0,00$0.00. Решение: awk с LC_ALL=C корректно форматирует числа с точкой независимо от системной локали.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Проблема
На системах с русской локалью statusline выводил дублированную стоимость вида
$0,00$0.00.Причина:
bash printfсLC_NUMERIC=Cигнорировался, выводя запятую0,00. Это активировало fallback|| echo "$0.00", что приводило к дублированию вывода.Решение
Заменил
printfнаawkсLC_ALL=C, который корректно форматирует числа с точкой независимо от системной локали.Было:
Стало:
Результат
Теперь statusline корректно показывает:
.claude • Sonnet 4.5 • $1.37 • $1.37 / $10.50 • 9%Problem
On Russian locale systems, statusline displayed duplicated cost like
$0,00$0.00.Root cause:
bash printfwithLC_NUMERIC=Cwas ignored, outputting comma0,00. This triggered fallback|| echo "$0.00", resulting in duplicated output.Solution
Replaced
printfwithawkusingLC_ALL=C, which reliably formats numbers with period decimal separator regardless of system locale.Result
Statusline now correctly displays:
.claude • Sonnet 4.5 • $1.37 • $1.37 / $10.50 • 9%