项目作者: Ryanhtech

项目描述 :
An open source Python module for translating your Python apps in many languages.
高级语言: Python
项目地址: git://github.com/Ryanhtech/language-manager.git
创建时间: 2020-12-02T19:24:00Z
项目社区:https://github.com/Ryanhtech/language-manager

开源协议:Apache License 2.0

下载


LanguageManager

An open source Python module for translating your Python apps in many languages.

How to add LanguageManager in your app?

Just follow these steps:

  • Copy the source files somewhere in your project (It is recommended to create a new directory in your project just for LanguageManager)
  • Add a file in the folder language_manager/packages, for example en-US.langpkg.
  • In this file, add your keys and values, like in a Python dictionary:

LANGUAGE = { The root of the dictionary

[TAB]"name": "en-US", The name of the language

[TAB]"contents": { The sub-dictionary in which you will put your keys

[TAB][TAB]"main": "Hello World!", A key called “main” with a value of “Hello World!”

[TAB][TAB]... Other keys and values

[TAB]},

}

To use Language Manager in your app, just follow these instructions:

  • Import language_manager.LanguageManager in your app (or modules.languagemanager.LanguageManager, for example).
  • To get a key from a language database, call:

language_manager.LanguageManager.get_key(language_name, key)