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

Conversation

lykahb
Copy link
Contributor

@lykahb lykahb commented Sep 26, 2024

This replaces the B&W in the graph and the stats box. I took a liberty to update the other languages. Luckily, all supported languages have the colors begin with the different letters.

image

"Потягніть для вибору області інтересу. Виберіть одну точку для"
"скасування області."
"Потягніть для вибору області інтересу. Виберіть одну точку для скасування "
"області."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the past PR #712 I formatted this file manually rather than used the i18n.py script. So there would be many unrelated changes in this file.

msgstr "Ч"

msgid "short color W"
msgstr "Б"
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 new messages for the graph and stats.

@@ -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.

@@ -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.

@lykahb lykahb force-pushed the lykahb/localize-black-white branch from 5e3e923 to f06f626 Compare September 27, 2024 04:05
@lykahb lykahb force-pushed the lykahb/localize-black-white branch from f06f626 to 04709d4 Compare September 27, 2024 04:06
@@ -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.

@sanderland
Copy link
Owner

sanderland commented Sep 27, 2024

Thanks. Will pass this by the community for any local conventions. Edit: consensus is 🚀

@sanderland sanderland merged commit cf8ca1a into sanderland:master Sep 28, 2024
3 checks passed
@kaorahi
Copy link
Contributor

kaorahi commented Oct 4, 2024

Is this a wrong way to show the localized color names in the "Player Setup" menu?

localized

--- a/katrain/gui.kv
+++ b/katrain/gui.kv
@@ -200,6 +200,7 @@
         pos: (image.x, image.y)
         size: image.size
         font_size: root.min_size * 1.2 / (1 + 1 * len(self.text))
+        font_name: i18n.font_name
 
 # UI components
 
@@ -934,7 +935,7 @@
         ClickableCircle:
             size_hint: 0.8, 0.8
             pos_hint: {'center_x':0.5,'center_y':0.5}
-            text: root.player[0]
+            text: i18n._(f'short color {root.player}')
             player: root.player
             on_left_press: root.parent.swap_players()
     MDBoxLayout:

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.

3 participants