Skip to content

Commit

Permalink
Add name to Formatters. Relates to #195.
Browse files Browse the repository at this point in the history
  • Loading branch information
aussig committed Apr 10, 2024
1 parent cacbc1c commit c1fca25
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bgstally/formatters/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from bgstally.activity import Activity
from bgstally.constants import DiscordActivity
from bgstally.state import State
from bgstally.utils import _


class FormatterInterface:
Expand All @@ -16,6 +17,15 @@ def __init__(self, state: State):
self.state: State = state


def get_name(self) -> str:
"""Get the name of this formatter
Returns:
str: The name of this formatter for choosing in the UI
"""
pass


def generate_text(self, activity: Activity, activity_mode: DiscordActivity, discord: bool = False, system_names: list = None, lang: str = None) -> str:
"""Generate formatted text for a given instance of Activity
Expand Down
9 changes: 9 additions & 0 deletions bgstally/formatters/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ def __init__(self, state: State):
super(DefaultFormatter, self).__init__(state)


def get_name(self) -> str:
"""Get the name of this formatter for presenting in the UI
Returns:
str: The name
"""
return _("Default") # LANG: Name of default output formatter


def generate_text(self, activity: Activity, activity_mode: DiscordActivity, discord: bool = False, system_names: list = None, lang: str = None) -> str:
"""Generate formatted text for a given instance of Activity
Expand Down

0 comments on commit c1fca25

Please sign in to comment.