-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added localization framework to mssql-cli
- Loading branch information
Gene Lee
committed
Aug 22, 2019
1 parent
595e2ad
commit 68d0020
Showing
3 changed files
with
50 additions
and
24 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from importlib import import_module | ||
import gettext | ||
import os | ||
|
||
CLI_NAME = 'mssql-cli' | ||
MODULE = 'mssqlcli' | ||
|
||
def translate(): | ||
""" | ||
Gets the localized translation of message, based on the current global | ||
domain, language, and locale directory of the module. | ||
:param mod: The module namespace containing the locale for translation. | ||
:return: The localized translation of message, based on the current global | ||
domain, language, and locale directory alias. | ||
""" | ||
modulePath = os.path.dirname(import_module(MODULE).__file__) | ||
localedir = os.path.join(modulePath, 'locale') | ||
domain = CLI_NAME | ||
return gettext.translation(domain, localedir, fallback=True).gettext |
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