mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-12 05:15:18 -05:00
More localization (#358)
* Translate missing items on About page * Localize import summary dialog * Make site menu translation reactive * Localize import options * Include semi colon in string * Move API texts to frontend + better status codes * Provide feedback to user when no meal is planned * Fix API tests after latest rework * Add warning for API changes in changelog * Refactor API texts handling * Refactor API texts handling #2 * Better API feedback * Rearrange strings hierarchy * Add messages upon recipe updated * Fix 'recipe effected' typo * Remove snackbar usage in backend * Translate toolbox * Provide feedback for tags CRUD * Fix messed up merge * Translate sign-up form * Better feedback for sign-up CRUD * Refactor log-in API texts handling * No error message when user is not authenticated * Remove unimportant console log
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
class SnackResponse:
|
||||
@staticmethod
|
||||
def _create_response(message: str, type: str, additional_data: dict = None) -> dict:
|
||||
|
||||
snackbar = {"snackbar": {"text": message, "type": type}}
|
||||
|
||||
if additional_data:
|
||||
snackbar.update(additional_data)
|
||||
|
||||
return snackbar
|
||||
|
||||
@staticmethod
|
||||
def success(message: str, additional_data: dict = None) -> dict:
|
||||
return SnackResponse._create_response(message, "success", additional_data)
|
||||
|
||||
@staticmethod
|
||||
def info(message: str, additional_data: dict = None) -> dict:
|
||||
return SnackResponse._create_response(message, "info", additional_data)
|
||||
|
||||
@staticmethod
|
||||
def warning(message: str, additional_data: dict = None) -> dict:
|
||||
return SnackResponse._create_response(message, "warning", additional_data)
|
||||
|
||||
@staticmethod
|
||||
def error(message: str, additional_data: dict = None) -> dict:
|
||||
return SnackResponse._create_response(message, "error", additional_data)
|
||||
Reference in New Issue
Block a user