-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Anbarryprojects:v1
[REF] Refactored examples by new changes.
- Loading branch information
Showing
11 changed files
with
100 additions
and
68 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
from fastapi import FastAPI, Request | ||
|
||
from fastapi_babel import Babel | ||
from fastapi_babel import BabelConfigs | ||
from fastapi_babel import _ | ||
|
||
|
||
configs = BabelConfigs( | ||
ROOT_DIR=__file__, | ||
BABEL_DEFAULT_LOCALE="en", | ||
BABEL_TRANSLATION_DIRECTORY="lang", | ||
) | ||
|
||
babel: Babel = Babel(configs=configs) | ||
|
||
if __name__ == "__main__": | ||
babel.run_cli() | ||
from fastapi_babel import Babel | ||
from fastapi_babel import BabelConfigs | ||
from fastapi_babel import _ | ||
|
||
|
||
configs = BabelConfigs( | ||
ROOT_DIR=__file__, | ||
BABEL_DEFAULT_LOCALE="en", | ||
BABEL_TRANSLATION_DIRECTORY="lang", | ||
) | ||
|
||
babel: Babel = Babel(configs=configs) | ||
|
||
if __name__ == "__main__": | ||
babel.run_cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,12 @@ | |
from .middleware import BabelMiddleware | ||
from .properties import RootConfigs as BabelConfigs | ||
|
||
__version__ = "0.0.8" | ||
__version__ = "0.0.9" | ||
__author__ = "[email protected]" | ||
__all__ = ["Babel", "BabelCli", "BabelConfigs", "_"] | ||
__all__ = [ | ||
"Babel", | ||
"BabelCli", | ||
"BabelConfigs", | ||
"_", | ||
"BabelMiddleware", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
from typing import Optional | ||
|
||
|
||
class BabelProxyError(Exception): | ||
"""When babel proxy object points to a None object will raise this error""" | ||
def __init__(self, *args: object) -> None: | ||
super().__init__("Proxy object points to an empty lookup instance") | ||
|
||
def __init__(self, message: Optional[str] = None) -> None: | ||
self.message: str = "Proxy object points to an empty lookup instance" | ||
if message: | ||
self.message = message | ||
super().__init__("Proxy object points to an empty lookup instance") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
fastapi | ||
babel | ||
uvicorn | ||
pathlib | ||
uvicorn |