Skip to main content

Mô tả ngắn gọn về thư viện

Project description

Lang Custom

Lang Custom is a simple Python library for managing and loading translations from JSON files.

Installation

You can install this library using pip:

pip install lang_custom

Usage Guide

1. Import the library

import lang_custom

2. Get available languages

To list all available languages in the Lang_data directory, use:

languages = lang_custom.get()
print(languages)  # Example: ['en', 'vi']

3. Select a data group

Before retrieving text, you need to select a data group from the JSON file:

lang_custom.set_group("name")

Where name is the group you want to access in the JSON file.

4. Retrieve text data

After selecting a group, retrieve text using:

text = lang_custom.get_text("en", "text")
print(text)  # Displays the corresponding value for key "text" in group "name" from en.json

Where:

  • "en" is the language code.
  • "text" is the key to retrieve within the selected group.

Language File Structure

Each language is stored in the Lang_data directory as a JSON file. Example of en.json:

{
    "name": {
        "text": "hello friend :D",
        "example": "text2"
    },
    "name2": {
        "example": "text",
        "example2": "text2"
    }
}

Feedback & Issues

For any feedback or issues, please contact me: Discord me

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lang_custom-1.0.9.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lang_custom-1.0.9-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file lang_custom-1.0.9.tar.gz.

File metadata

  • Download URL: lang_custom-1.0.9.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lang_custom-1.0.9.tar.gz
Algorithm Hash digest
SHA256 137e20c5c05cd45d3b9408cadf640e2948e6d2e292a87ff86147227f5f6943d0
MD5 01dac06002307b754325300af99f8aaf
BLAKE2b-256 8c67ab5abf1d19db495b7493cf68395ff8fe2d3f491847310d03880c72c94995

See more details on using hashes here.

File details

Details for the file lang_custom-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: lang_custom-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lang_custom-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b87bcdf20ed298384e6fb1cd46228dee1eb241641bf61080fdbf52850b125105
MD5 0e73a244c03ad7ddec0c9bf93a687a0f
BLAKE2b-256 1adf749b521be75abb4b7a15c1a7bc8e809749a31365b0cc5c7f58280428feb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page