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.10.tar.gz (3.9 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.10-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lang_custom-1.0.10.tar.gz
  • Upload date:
  • Size: 3.9 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.10.tar.gz
Algorithm Hash digest
SHA256 cc50c1767b072fb7f0e4154a69358eebf81c732b2f3acbdd36fc02f80d191457
MD5 b77cd6ca0b8631505e22814e37a09502
BLAKE2b-256 0643f036ee34ef2925c9a497a677c264c5a21fcfb9367171b0cfba24d97d7a90

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lang_custom-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 2ddfadb82671ee6eb4651152fd4199dfc6de0679bb06b854b10e9681e43ec70a
MD5 8b00dc445d7fe576d7842d4dd6ee25cf
BLAKE2b-256 29ba2eb254ac12ca7dc457f4f577803fa11d51c9c8b41cf6bf0e6638c5a6bba8

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