-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature choose language #22
base: main
Are you sure you want to change the base?
Changes from all commits
1fc7e30
d96ad39
160440b
aba6e1b
f176cc7
70f87fb
1fb9a52
63ade95
13036fd
61866e1
ba981e6
047120c
c2ac056
01d98c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
from typing import Union | ||
|
||
import typer | ||
from enum import Enum | ||
from rich import box | ||
from rich.align import Align | ||
from rich.console import Console, RenderableType | ||
|
@@ -131,6 +132,45 @@ def quotes(show: bool = True) -> None: | |
) | ||
|
||
|
||
class language(str, Enum): | ||
english = "english" | ||
spanish = "spanish" | ||
|
||
|
||
@app.command("language", rich_help_panel="Utils and Configs") | ||
def language( | ||
lang: language = typer.Option(language.english, case_sensitive=False) | ||
) -> None: | ||
"""Choose language 🛩️""" | ||
settings = Settings().get_settings() | ||
if settings["language"] == lang: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here it would be better to have just an if with the comparison of different. And in the end have only one center_print to avoid code duplication, like this: if settings["language"] != lang:
settings["language"] = lang
Settings().write_settings(settings)
# Here function Dowload quotes
center_print(
Rule(
"Thanks for letting me know that!",
style=insert_or_delete_line_style,
),
style=insert_or_delete_text_style,
)
cener_print(
Rule(
f"Current language is: {lang}",
style=insert_or_delete_line_style,
),
style=insert_or_delete_text_style,
) |
||
center_print( | ||
Rule( | ||
f"Current language is: {lang}", | ||
style=insert_or_delete_line_style, | ||
), | ||
style=insert_or_delete_text_style, | ||
) | ||
else: | ||
settings["language"] = lang | ||
Settings().write_settings(settings) | ||
# Here function Dowload quotes | ||
center_print( | ||
Rule( | ||
"Thanks for letting me know that!", | ||
style=insert_or_delete_line_style, | ||
), | ||
style=insert_or_delete_text_style, | ||
) | ||
center_print( | ||
Rule( | ||
f"Current language is: {lang}", | ||
style=insert_or_delete_line_style, | ||
), | ||
style=insert_or_delete_text_style, | ||
) | ||
|
||
|
||
@app.command('tasks', short_help='Show all Tasks :open_book:') | ||
@app.command(short_help='[s]Show all Tasks :open_book:[/]', deprecated=True) | ||
def showtasks() -> None: | ||
|
@@ -481,6 +521,18 @@ def setup() -> None: | |
) | ||
console.print(code_markdown) | ||
|
||
code_markdown = Markdown( | ||
""" | ||
pls language --lang <language> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is correct? |
||
""" | ||
) | ||
|
||
center_print( | ||
'If you want to change the language of quotes, please use:', | ||
style='red', | ||
) | ||
console.print(code_markdown) | ||
|
||
center_print( | ||
'To apply the changes restart the terminal or use this command:', | ||
style='red', | ||
|
@@ -503,6 +555,8 @@ def setup() -> None: | |
else: | ||
settings['show_quotes'] = True | ||
|
||
settings['language'] = 'english' | ||
|
||
settings['tasks'] = [] | ||
Settings().write_settings(settings) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to use the short form, like
en
for english andes
for spanish, what do you think?