From 74a05744628a990ec8de756cd9bde87f8ff74416 Mon Sep 17 00:00:00 2001
From: Ludy
Date: Thu, 4 Apr 2024 11:16:10 +0200
Subject: [PATCH] Update progress of language (#1029)
---
README.md | 88 +++++++++++++++---------
scripts/counter_translation.py | 122 +++++++++++++++++++++++++++++++++
2 files changed, 179 insertions(+), 31 deletions(-)
create mode 100644 scripts/counter_translation.py
diff --git a/README.md b/README.md
index 9ae9ba9d..41197b3c 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-
Stirling-PDF
-
+
+Stirling-PDF
[![Docker Pulls](https://img.shields.io/docker/pulls/frooodle/s-pdf)](https://hub.docker.com/r/frooodle/s-pdf)
[![Discord](https://img.shields.io/discord/1068636748814483718?label=Discord)](https://discord.gg/Cn8pWhQRxZ)
@@ -19,16 +19,17 @@ All files and PDFs exist either exclusively on the client side, reside in server
![stirling-home](images/stirling-home.jpg)
## Features
+
- Dark mode support.
- Custom download options (see [here](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/images/settings.png) for example)
- Parallel file processing and downloads
- API for integration with external scripts
- Optional Login and Authentication support (see [here](https://github.com/Stirling-Tools/Stirling-PDF/tree/main#login-authentication) for documentation)
-
## **PDF Features**
### **Page Operations**
+
- View and modify PDFs - View multi page PDFs with custom viewing sorting and searching. Plus on page edit features like annotate, draw and adding text and images. (Using PDF.js with Joxit and Liberation.Liberation fonts)
- Full interactive GUI for merging/splitting/rotating/moving PDFs and their pages.
- Merge multiple PDFs together into a single resultant file.
@@ -45,6 +46,7 @@ All files and PDFs exist either exclusively on the client side, reside in server
- Convert PDF to a single page.
### **Conversion Operations**
+
- Convert PDFs to and from images.
- Convert any common file to PDF (using LibreOffice).
- Convert PDF to Word/Powerpoint/Others (using LibreOffice).
@@ -53,6 +55,7 @@ All files and PDFs exist either exclusively on the client side, reside in server
- Markdown to PDF.
### **Security & Permissions**
+
- Add and remove passwords.
- Change/set PDF Permissions.
- Add watermark(s).
@@ -61,6 +64,7 @@ All files and PDFs exist either exclusively on the client side, reside in server
- Auto-redact text.
### **Other Operations**
+
- Add/Generate/Write signatures.
- Repair PDFs.
- Detect and remove blank pages.
@@ -77,11 +81,11 @@ All files and PDFs exist either exclusively on the client side, reside in server
- Flatten PDFs.
- Get all information on a PDF to view or export as JSON.
-
For a overview of the tasks and the technology each uses please view [Endpoint-groups.md](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/Endpoint-groups.md)
Demo of the app is available [here](https://stirlingpdf.io). username: demo, password: demo
## Technologies used
+
- Spring Boot + Thymeleaf
- [PDFBox](https://github.com/apache/pdfbox/tree/trunk)
- [LibreOffice](https://www.libreoffice.org/discover/libreoffice/) for advanced conversions
@@ -94,9 +98,11 @@ Demo of the app is available [here](https://stirlingpdf.io). username: demo, pas
## How to use
### Locally
+
Please view https://github.com/Stirling-Tools/Stirling-PDF/blob/main/LocalRunGuide.md
### Docker / Podman
+
https://hub.docker.com/r/frooodle/s-pdf
Stirling PDF has 2 different versions, a Full version and ultra-Lite version. Depending on the types of features you use you may want a smaller image to save on space.
@@ -106,6 +112,7 @@ For people that don't mind about space optimization just use the latest tag.
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/frooodle/s-pdf/latest-ultra-lite?label=Stirling-PDF%20Ultra-Lite)
Docker Run
+
```bash
docker run -d \
-p 8080:8080 \
@@ -122,7 +129,9 @@ docker run -d \
-v /location/of/customFiles:/customFiles \
```
+
Docker Compose
+
```yaml
version: '3.3'
services:
@@ -143,54 +152,60 @@ services:
Note: Podman is CLI-compatible with Docker, so simply replace "docker" with "podman".
## Enable OCR/Compression feature
+
Please view https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToUseOCR.md
## Supported Languages
Stirling PDF currently supports 26!
-- English (English) (en_GB)
-- English (US) (en_US)
-- Arabic (العربية) (ar_AR)
-- German (Deutsch) (de_DE)
-- French (Français) (fr_FR)
-- Spanish (Español) (es_ES)
-- Simplified Chinese (简体中文) (zh_CN)
-- Traditional Chinese (繁體中文) (zh_TW)
-- Catalan (Català) (ca_CA)
-- Italian (Italiano) (it_IT)
-- Swedish (Svenska) (sv_SE)
-- Polish (Polski) (pl_PL)
-- Romanian (Română) (ro_RO)
-- Korean (한국어) (ko_KR)
-- Portuguese Brazilian (Português) (pt_BR)
-- Russian (Русский) (ru_RU)
-- Basque (Euskara) (eu_ES)
-- Japanese (日本語) (ja_JP)
-- Dutch (Nederlands) (nl_NL)
-- Greek (el_GR)
-- Turkish (Türkçe) (tr_TR)
-- Indonesia (Bahasa Indonesia) (id_ID)
-- Hindi (हिंदी) (hi_IN)
-- Hungarian (Magyar) (hu_HU)
-- Bulgarian (Български) (bg_BG)
-- Sebian Latin alphabet (Srpski) (sr_LATN_RS)
+
+| Language | Progress |
+| ------------------------------------------- | -------------------------------------- |
+| English (English) (en_GB) | ![100%](https://geps.dev/progress/100) |
+| English (US) (en_US) | ![100%](https://geps.dev/progress/100) |
+| Arabic (العربية) (ar_AR) | ![58%](https://geps.dev/progress/58) |
+| German (Deutsch) (de_DE) | ![95%](https://geps.dev/progress/95) |
+| French (Français) (fr_FR) | ![99%](https://geps.dev/progress/99) |
+| Spanish (Español) (es_ES) | ![95%](https://geps.dev/progress/95) |
+| Simplified Chinese (简体中文) (zh_CN) | ![99%](https://geps.dev/progress/99) |
+| Traditional Chinese (繁體中文) (zh_TW) | ![97%](https://geps.dev/progress/97) |
+| Catalan (Català) (ca_CA) | ![65%](https://geps.dev/progress/65) |
+| Italian (Italiano) (it_IT) | ![99%](https://geps.dev/progress/99) |
+| Swedish (Svenska) (sv_SE) | ![58%](https://geps.dev/progress/58) |
+| Polish (Polski) (pl_PL) | ![60%](https://geps.dev/progress/60) |
+| Romanian (Română) (ro_RO) | ![58%](https://geps.dev/progress/58) |
+| Korean (한국어) (ko_KR) | ![92%](https://geps.dev/progress/92) |
+| Portuguese Brazilian (Português) (pt_BR) | ![74%](https://geps.dev/progress/74) |
+| Russian (Русский) (ru_RU) | ![92%](https://geps.dev/progress/92) |
+| Basque (Euskara) (eu_ES) | ![76%](https://geps.dev/progress/76) |
+| Japanese (日本語) (ja_JP) | ![92%](https://geps.dev/progress/92) |
+| Dutch (Nederlands) (nl_NL) | ![92%](https://geps.dev/progress/92) |
+| Greek (Ελληνικά) (el_GR) | ![77%](https://geps.dev/progress/77) |
+| Turkish (Türkçe) (tr_TR) | ![82%](https://geps.dev/progress/82) |
+| Indonesia (Bahasa Indonesia) (id_ID) | ![87%](https://geps.dev/progress/87) |
+| Hindi (हिंदी) (hi_IN) | ![88%](https://geps.dev/progress/88) |
+| Hungarian (Magyar) (hu_HU) | ![87%](https://geps.dev/progress/87) |
+| Bulgarian (Български) (bg_BG) | ![82%](https://geps.dev/progress/82) |
+| Sebian Latin alphabet (Srpski) (sr_LATN_RS) | ![89%](https://geps.dev/progress/89) |
## Contributing (creating issues, translations, fixing bugs, etc.)
Please see our [Contributing Guide](CONTRIBUTING.md)!
## Customisation
+
Stirling PDF allows easy customization of the app.
Includes things like
+
- Custom application name
- Custom slogans, icons, images, and even custom HTML (via file overrides)
-
There are two options for this, either using the generated settings file ``settings.yml``
This file is located in the ``/configs`` directory and follows standard YAML formatting
Environment variables are also supported and would override the settings file
For example in the settings.yml you have
+
```yaml
system:
defaultLocale: 'en-US'
@@ -199,6 +214,7 @@ system:
To have this via an environment variable you would have ``SYSTEM_DEFAULTLOCALE``
The Current list of settings is
+
```yaml
security:
enableLogin: false # set to 'true' to enable login
@@ -221,24 +237,31 @@ endpoints:
metrics:
enabled: true # 'true' to enable Info APIs endpoints (view http://localhost:8080/swagger-ui/index.html#/API to learn more), 'false' to disable
```
+
### Extra notes
+
- Endpoints. Currently, the endpoints ENDPOINTS_TO_REMOVE and GROUPS_TO_REMOVE can include comma separate lists of endpoints and groups to disable as example ENDPOINTS_TO_REMOVE=img-to-pdf,remove-pages would disable both image-to-pdf and remove pages, GROUPS_TO_REMOVE=LibreOffice Would disable all things that use LibreOffice. You can see a list of all endpoints and groups [here](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/Endpoint-groups.md)
- customStaticFilePath. Customise static files such as the app logo by placing files in the /customFiles/static/ directory. An example of customising app logo is placing a /customFiles/static/favicon.svg to override current SVG. This can be used to change any images/icons/css/fonts/js etc in Stirling-PDF
### Environment only parameters
+
- ``SYSTEM_ROOTURIPATH`` ie set to ``/pdf-app`` to Set the application's root URI to ``localhost:8080/pdf-app``
- ``SYSTEM_CONNECTIONTIMEOUTMINUTES`` to set custom connection timeout values
- ``DOCKER_ENABLE_SECURITY`` to tell docker to download security jar (required as true for auth login)
- ``INSTALL_BOOK_AND_ADVANCED_HTML_OPS`` to download calibre onto stirling-pdf enabling pdf to/from book and advanced html conversion
## API
+
For those wanting to use Stirling-PDFs backend API to link with their own custom scripting to edit PDFs you can view all existing API documentation
[here](https://app.swaggerhub.com/apis-docs/Stirling-Tools/Stirling-PDF/) or navigate to /swagger-ui/index.html of your stirling-pdf instance for your versions documentation (Or by following the API button in your settings of Stirling-PDF)
## Login authentication
+
![stirling-login](images/login-light.png)
+
### Prerequisites:
+
- User must have the folder ./configs volumed within docker so that it is retained during updates.
- Docker uses must download the security jar version by setting ``DOCKER_ENABLE_SECURITY`` to ``true`` in environment variables.
- Then either enable login via the settings.yml file or via setting ``SECURITY_ENABLE_LOGIN`` to ``true``
@@ -257,6 +280,7 @@ For API usage you must provide a header with 'X-API-Key' and the associated API
## FAQ
### Q1: What are your planned features?
+
- Progress bar/Tracking
- Full custom logic pipelines to combine multiple operations together.
- Folder support with auto scanning to perform operations on
@@ -266,7 +290,9 @@ For API usage you must provide a header with 'X-API-Key' and the associated API
- Fill forms manually or automatically
### Q2: Why is my application downloading .htm files?
+
This is an issue caused commonly by your NGINX configuration. The default file upload size for NGINX is 1MB, you need to add the following in your Nginx sites-available file. ``client_max_body_size SIZE;`` Where "SIZE" is 50M for example for 50MB files.
### Q3: Why is my download timing out
+
NGINX has timeout values by default so if you are running Stirling-PDF behind NGINX you may need to set a timeout value such as adding the config ``proxy_read_timeout 3600;``
diff --git a/scripts/counter_translation.py b/scripts/counter_translation.py
new file mode 100644
index 00000000..c7f57575
--- /dev/null
+++ b/scripts/counter_translation.py
@@ -0,0 +1,122 @@
+"""A script to update language progress status in README.md based on
+properties file comparison.
+
+This script compares default properties file with others in a directory to
+determine language progress.
+It then updates README.md based on provided progress list.
+
+Author: Ludy87
+
+Example:
+ To use this script, simply run it from command line:
+ $ python counter_translation.py
+"""
+import os
+import glob
+import re
+from typing import List, Tuple
+
+
+def write_readme(progress_list: List[Tuple[str, int]]) -> None:
+ """
+ Updates the progress status in the README.md file based
+ on the provided progress list.
+
+ Parameters:
+ progress_list (List[Tuple[str, int]]): A list of tuples containing
+ language and progress percentage.
+
+ Returns:
+ None
+ """
+ with open("README.md", "r", encoding="utf-8") as file:
+ content = file.read()
+
+ lines = content.split("\n")
+ for i, line in enumerate(lines[2:], start=2):
+ for progress in progress_list:
+ language, value = progress
+ if language in line:
+ match = re.search(r"\!\[(\d+(\.\d+)?)%\]\(.*\)", line)
+ if match:
+ lines[i] = line.replace(
+ match.group(0),
+ f"![{value}%](https://geps.dev/progress/{value})",
+ )
+
+ new_content = "\n".join(lines)
+
+ with open("README.md", "w", encoding="utf-8") as file:
+ file.write(new_content)
+
+
+def compare_files(default_file_path, files_directory) -> List[Tuple[str, int]]:
+ """
+ Compares the default properties file with other
+ properties files in the directory.
+
+ Parameters:
+ default_file_path (str): The path to the default properties file.
+ files_directory (str): The directory containing other properties files.
+
+ Returns:
+ List[Tuple[str, int]]: A list of tuples containing
+ language and progress percentage.
+ """
+ file_paths = glob.glob(os.path.join(files_directory, "messages_*.properties"))
+ num_lines = sum(1 for _ in open(default_file_path, encoding="utf-8"))
+
+ result_list = []
+
+ for file_path in file_paths:
+ language = (
+ os.path.basename(file_path)
+ .split("messages_", 1)[1]
+ .split(".properties", 1)[0]
+ )
+
+ fails = 0
+ if "en_GB" in language or "en_US" in language:
+ result_list.append(("en_GB", 100))
+ result_list.append(("en_US", 100))
+ continue
+
+ with open(default_file_path, "r", encoding="utf-8") as default_file, open(
+ file_path, "r", encoding="utf-8"
+ ) as file:
+ for _ in range(5):
+ next(default_file)
+ try:
+ next(file)
+ except StopIteration:
+ fails = num_lines
+
+ for _, (line_default, line_file) in enumerate(
+ zip(default_file, file), start=6
+ ):
+ try:
+ if (
+ line_default.split("=", 1)[1].strip()
+ == line_file.split("=", 1)[1].strip()
+ ):
+ fails += 1
+ except IndexError:
+ pass
+
+ result_list.append(
+ (
+ language,
+ int((num_lines - fails) * 100 / num_lines),
+ )
+ )
+
+ unique_data = list(set(result_list))
+ unique_data.sort(key=lambda x: x[1], reverse=True)
+
+ return unique_data
+
+
+if __name__ == "__main__":
+ directory = os.path.join(os.getcwd(), "src", "main", "resources")
+ reference_file = os.path.join(directory, "messages_en_GB.properties")
+ write_readme(compare_files(reference_file, directory))