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

Localize short names for black and white #714

Merged
merged 8 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ KaTrain is a tool for analyzing games and playing go with AI feedback from KataG
<a href="http://github.com/sanderland/katrain/blob/master/README.md"><img alt="English" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-uk.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=de&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="German" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-de.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=fr&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="French" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-fr.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=uk&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Ukrainian" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-ua.png" width=50></a>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed the list of localizations in the previous PR. Added it in the same order as in the UI.

<a href="http://translate.google.com/translate?sl=en&tl=ru&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Russian" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-ru.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=tr&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Turkish" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-tr.png" width=50></a>
<br/>

<a href="http://translate.google.com/translate?sl=en&tl=tr&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Turkish" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-tr.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=zh-CN&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Simplified Chinese" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-cn.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=zh-TW&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Traditional Chinese" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-tw.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=ko&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Korean" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-ko.png" width=50></a>
Expand Down
8 changes: 6 additions & 2 deletions katrain/core/game_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ def score(self) -> Optional[float]:
def format_score(self, score=None):
score = score or self.score
if score is not None:
return f"{'B' if score >= 0 else 'W'}+{abs(score):.1f}"
leading_player = 'B' if score >= 0 else 'W'
leading_player_color = i18n._(f"short color {leading_player}")
return f"{leading_player_color}+{abs(score):.1f}"

@property
def winrate(self) -> Optional[float]:
Expand All @@ -302,7 +304,9 @@ def winrate(self) -> Optional[float]:
def format_winrate(self, win_rate=None):
win_rate = win_rate or self.winrate
if win_rate is not None:
return f"{'B' if win_rate > 0.5 else 'W'} {max(win_rate,1-win_rate):.1%}"
leading_player = 'B' if win_rate > 0.5 else 'W'
leading_player_color = i18n._(f"short color {leading_player}")
return f"{leading_player_color} {max(win_rate,1-win_rate):.1%}"

def move_policy_stats(self) -> Tuple[Optional[int], float, List]:
single_move = self.move
Expand Down
2 changes: 1 addition & 1 deletion katrain/gui.kv
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@
StatsLabel:
id: pointloss_label
label: i18n._('stats:pointslost') if root.points_lost is None or root.points_lost > 0 else i18n._('stats:pointsgained')
text: '{}: {:.1f}'.format(root.player,abs(root.points_lost)) if root.points_lost is not None else '...'
text: '{}: {:.1f}'.format(i18n._(f'short color {root.player}'), abs(root.points_lost)) if root.points_lost is not None else '...'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's more logic than most of the UI elements have. I considered extracting this into Python and passing points_delta_label & points_delta but decided to keep the scope more focused.

color: Theme.POINTLOSS_COLOR

<ScrollableLabel>:
Expand Down
4 changes: 2 additions & 2 deletions katrain/gui/widgets/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def update_graph(self, *args):
font_size: root.marker_font_size
color: Theme.SCORE_MARKER_COLOR
pos: root.x + root.width - self.width-1, root.pos[1]+root.height - self.font_size - 1
text: 'B+{}'.format(root.score_scale)
text: '{}+{}'.format(i18n._('short color B'), root.score_scale)
opacity: int(root.show_score)
GraphMarkerLabel:
font_size: root.marker_font_size
Expand All @@ -223,7 +223,7 @@ def update_graph(self, *args):
font_size: root.marker_font_size
color: Theme.SCORE_MARKER_COLOR
pos: root.x + root.width - self.width-1, root.pos[1]
text: 'W+' + str(int(root.score_scale))
text: '{}+{}'.format(i18n._('short color W'), root.score_scale)
opacity: int(root.show_score)
# wr ticks
GraphMarkerLabel:
Expand Down
Binary file modified katrain/i18n/locales/cn/LC_MESSAGES/katrain.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions katrain/i18n/locales/cn/LC_MESSAGES/katrain.po
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ msgstr "分数图"
msgid "Jigo"
msgstr "和棋"

msgid "short color B"
msgstr "黑"

msgid "short color W"
msgstr "白"

msgid "closedlabel:movestats"
msgstr "每步统计"

Expand Down
Binary file modified katrain/i18n/locales/de/LC_MESSAGES/katrain.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions katrain/i18n/locales/de/LC_MESSAGES/katrain.po
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ msgstr "Punkte-Graph"
msgid "Jigo"
msgstr "Jigo"

msgid "short color B"
msgstr "S"

msgid "short color W"
msgstr "W"

msgid "closedlabel:movestats"
msgstr "Zug-Statistik"

Expand Down
Binary file modified katrain/i18n/locales/en/LC_MESSAGES/katrain.mo
Binary file not shown.
10 changes: 8 additions & 2 deletions katrain/i18n/locales/en/LC_MESSAGES/katrain.po
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ msgstr "Score Graph"
msgid "Jigo"
msgstr "Jigo"

msgid "short color B"
msgstr "B"

msgid "short color W"
msgstr "W"

msgid "closedlabel:movestats"
msgstr "Move Stats"

Expand Down Expand Up @@ -765,8 +771,8 @@ msgstr "KataGo"

msgid "aihelp:default"
msgstr ""
"Full strength KataGo AI. Strength is affected by 'max visits' and 'model' "
"in the general settings 'engine' section and engine configuration file. No "
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The i18n.py reformatted it.

"Full strength KataGo AI. Strength is affected by 'max visits' and 'model' in"
" the general settings 'engine' section and engine configuration file. No "
"options are available here."

#. ai which handles handicap games better
Expand Down
Binary file modified katrain/i18n/locales/fr/LC_MESSAGES/katrain.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions katrain/i18n/locales/fr/LC_MESSAGES/katrain.po
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ msgstr "Graphes"
msgid "Jigo"
msgstr "Jigo"

msgid "short color B"
msgstr "N"

msgid "short color W"
msgstr "B"

msgid "closedlabel:movestats"
msgstr "Évaluation"

Expand Down
Binary file modified katrain/i18n/locales/jp/LC_MESSAGES/katrain.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions katrain/i18n/locales/jp/LC_MESSAGES/katrain.po
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ msgstr "目差グラフ"
msgid "Jigo"
msgstr "持碁"

msgid "short color B"
msgstr "黒"

msgid "short color W"
msgstr "白"

msgid "closedlabel:movestats"
msgstr "着手の分析結果"

Expand Down
Binary file modified katrain/i18n/locales/ko/LC_MESSAGES/katrain.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions katrain/i18n/locales/ko/LC_MESSAGES/katrain.po
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ msgstr "집 차이/승률 그래프"
msgid "Jigo"
msgstr "무승부"

msgid "short color B"
msgstr "흑"

msgid "short color W"
msgstr "백"

msgid "closedlabel:movestats"
msgstr "착수 통계"

Expand Down
Binary file modified katrain/i18n/locales/ru/LC_MESSAGES/katrain.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions katrain/i18n/locales/ru/LC_MESSAGES/katrain.po
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ msgstr "График очков"
msgid "Jigo"
msgstr "Ничья"

msgid "short color B"
msgstr "Ч"

msgid "short color W"
msgstr "Б"

msgid "closedlabel:movestats"
msgstr "Статистика ходов"

Expand Down
Binary file modified katrain/i18n/locales/tr/LC_MESSAGES/katrain.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions katrain/i18n/locales/tr/LC_MESSAGES/katrain.po
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ msgstr "Skor Grafiği"
msgid "Jigo"
msgstr "Jigo"

msgid "short color B"
msgstr "S"

msgid "short color W"
msgstr "B"

msgid "closedlabel:movestats"
msgstr "Hamle İstatistikleri"

Expand Down
Binary file modified katrain/i18n/locales/tw/LC_MESSAGES/katrain.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions katrain/i18n/locales/tw/LC_MESSAGES/katrain.po
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ msgstr "分數圖"
msgid "Jigo"
msgstr "和棋"

msgid "short color B"
msgstr "黑"

msgid "short color W"
msgstr "白"

msgid "closedlabel:movestats"
msgstr "每步統計"

Expand Down
Binary file modified katrain/i18n/locales/ua/LC_MESSAGES/katrain.mo
Binary file not shown.
Loading