Skip to content

Commit

Permalink
fix: Fix notes card texts not being translated
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Mar 10, 2024
1 parent 799b337 commit 0a30523
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hoyo_buddy/draw/drawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def write(
msg = "Translator is not set"
raise RuntimeError(msg)

translated_text = self.translator.translate(text, self.locale)
translated_text = self.translator.translate(text, locale or self.locale)

font = self._get_font(size, style, locale)

Expand Down
4 changes: 4 additions & 0 deletions hoyo_buddy/draw/funcs/hoyo/genshin/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def draw_genshin_notes_card(
size=64,
position=(76, 67),
style="bold",
locale=locale,
)

drawer.write(
Expand Down Expand Up @@ -58,6 +59,7 @@ def draw_genshin_notes_card(
size=30,
position=(textbbox[2] + 20, textbbox[3] - 5),
anchor="ls",
locale=locale,
)

drawer.write(
Expand Down Expand Up @@ -92,6 +94,7 @@ def draw_genshin_notes_card(
size=30,
position=(textbbox[2] + 20, textbbox[3] - 5),
anchor="ls",
locale=locale,
)

exped_padding = 187
Expand Down Expand Up @@ -123,6 +126,7 @@ def draw_genshin_notes_card(
size=40,
position=(icon_pos[0] + icon.width + text_x_padding, 143 + index * exped_padding),
anchor="lm",
locale=locale,
)

buffer = BytesIO()
Expand Down
3 changes: 3 additions & 0 deletions hoyo_buddy/draw/funcs/hoyo/hsr/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def draw_hsr_notes_card(
size=64,
position=(76, 67),
style="bold",
locale=locale,
)

drawer.write(
Expand Down Expand Up @@ -75,6 +76,7 @@ def draw_hsr_notes_card(
size=30,
position=(textbbox[2] + 20, textbbox[3] - 5),
anchor="ls",
locale=locale,
)

drawer.write(
Expand Down Expand Up @@ -120,6 +122,7 @@ def draw_hsr_notes_card(
size=40,
position=(icon_pos[0] + icon.width + text_x_padding, 280 + index * exped_padding),
anchor="lm",
locale=locale,
)

buffer = BytesIO()
Expand Down

0 comments on commit 0a30523

Please sign in to comment.