semvec/pypi-packages huggingface dataset:
ezi18n 1.1.0
A custom i18n implementation that is built to be easily used.
Keywords: python, i18n, translation, localisation, localization


[Github](https://github.com/PearooXD/ezi18n) | [PyPI](https://pypi.org/project/ezi18n/)

--------
## Setting up
 Start by downloading the package via pip.
 ```
 python3 -m pip install ezi18n
 ```

 After that, you can just import it into your file.

--------
## Examples
 ```py
 import ezi18n
 import random
 
 _ = ezi18n.Translator() # if you don't provide anything in the brackets, it will look for the file's name's language JSON file. If the main file is  main.py, it will look for main_lang.json - unless you provide a base filename (in this case: main) and/or a suffix (by default: _lang)
 dice = random.randint(1, 6)
 language = input("What's your native language? / Was ist Deine Muttersprache? (en/de) >>> ")
 
 print(_("dice_result", language, dice=dice))
 ```
 ```json
 {
    "en": {
        "dice_result": "Your dice rolled {dice}!"
    },
    "de": {
        "dice_result": "Dein Würfel hat eine {dice} gewürfelt!"
    }
 }
 ```

 

-------
## Working with plurals
 ```py
 import ezi18n
 import locale
 
 _ = ezi18n.Translator("main", "_plurals") # this will look for main_plurals.json as the language JSON file
 apples = int(input("How many apples do you have? >>> "))
 language = locale.getlocale()[0][:2] # this will return the default OS language, such as en, hu, de, fr, es etc.
 
 print(_.one("apples", apples, language, apples=apples))
 ```
 ```json
 {
     "en": {
         "apples": ["You only have one apple! What a loser...", "You have {apples} apples!"]
     },
     "hu": {
         "apples": ["{apples} almád van!"]
     }
 }
 ```

 This example does a great job at presenting how the `.one()` function works. Here's the explanation for the code:

 The code will look for the default OS language, and will tell you how many apples you have with plurals in mind. I always get angry when I see "you have 1 apples"-ish text on a website, and it's an easy fix, but for some reason, many developers don't pay attention to it.

 Hungarian doesn't make a difference between plurals, so the list for "hu"/"apples" only has 1 item. This won't be a problem though - the library isn't hardcoded to only look for the first and second elements in the returned list, it will look for the **first** and the **last**. Which means that if a list only has 1 item, it will only return that item.
pdf-Creator-mr 0.0.4
A simple library for creating PDFs in Python. USE: Django,tkinter....


# PDF pdf-Creator-mr

Uma biblioteca simples para criacao de PDFs em Python. |
A simple library for creating PDFs in Python. |
Una biblioteca simple para crear PDFs en Python. |

Install

```sh
pip install reportlab



################################English################################
The PDFCreator class facilitates the creation of PDF documents using the ReportLab library in Python.

#Constructor
def __init__(self, filename, width=A4[0], height=A4[1]):
    """
    Initializes a PDFCreator object.

    :param filename: Name of the PDF file to create.
    :param width: Width of the PDF page (default is A4 width).
    :param height: Height of the PDF page (default is A4 height).
    """
Methods
    *add_title(title, fontsize=24, x=None, y=None)
        -Adds a title to the PDF.
    *add_paragraph(text, fontsize=12, spacing=0.5*inch, x=0, y=0)
        -Adds a paragraph of text to the PDF.
    *add_image(image_path, x=inch, y=None, width=2inch, height=2inch)
        -Adds an image to the PDF.
    *add_separator(thickness=1, start_x=inch, y_position=None, width=None)
        -Adds a horizontal separator line to the PDF.
    *add_vertical_line(start_y, end_y, x, thickness=1)
        -Adds a vertical line to the PDF.
    *add_square(width, height, x=inch, y=None)
        -Adds a square or rectangle shape to the PDF.
    *add_multiples_squares(squares, width=None, height=None, x=inch, y=inch)
        -Adds multiple squares or rectangles to the PDF.
    *save()
        -Saves the PDF document.