Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Lessica <82flex@gmail.com>
  • Loading branch information
Lessica committed Nov 5, 2024
1 parent 4100553 commit f6a9fa6
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 4 deletions.
179 changes: 175 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
packages
compile_commands.json

# Created by https://www.toptal.com/developers/gitignore/api/swift,macos,xcode
# Edit at https://www.toptal.com/developers/gitignore?templates=swift,macos,xcode
# Created by https://www.toptal.com/developers/gitignore/api/swift,macos,xcode,python
# Edit at https://www.toptal.com/developers/gitignore?templates=swift,macos,xcode,python

### macOS ###
# General
Expand Down Expand Up @@ -136,5 +136,176 @@ iOSInjectionProject/
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings

# End of https://www.toptal.com/developers/gitignore/api/swift,macos,xcode
n
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/swift,macos,xcode,python
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ We always built our app in the best quality.

At least, you need to provide `Localizable.strings` and `InfoPlist.strings`. Example: [Localizable.strings](https://github.com/Lessica/TrollRecorder/blob/main/res/en.lproj/Localizable.strings).

**🙇 PLEASE HELP US TRANSLATE!**

![Statistics](./res/stats.png)

## License

The core of TrollRecorder (command line tool / CLI), and only itself, is open-sourced here.
Expand Down
54 changes: 54 additions & 0 deletions devkit/i18n-statistics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import matplotlib.pyplot as plt
import pathlib


lproj_base = pathlib.Path('res')

available_languages = [
'en',
'es',
'fr',
'ko',
'vi',
'zh-Hans',
'zh-Hant-HK',
'zh-Hant-TW',
]

def get_lproj_path(lang) -> pathlib.Path:
return lproj_base / f'{lang}.lproj'

def get_lproj_strings_paths(lang) -> [pathlib.Path]:
return [
get_lproj_path(lang) / 'Localizable.strings',
get_lproj_path(lang) / 'InfoPlist.strings',
]

def get_lproj_strings_count(lang) -> tuple[int, int]:
all_lines = []
for strings_path in get_lproj_strings_paths(lang):
if strings_path.exists():
with open(strings_path, 'r') as f:
all_lines.extend(f.readlines())
todo_count = 0
for line in all_lines:
if line.find('/* TODO */') != -1 or line.find('/* Translated with ') != -1:
todo_count += 1
return int((len(all_lines) + 1) / 3), todo_count

if __name__ == '__main__':
x_labels = available_languages
y_values = []
for lang in available_languages:
total, todo = get_lproj_strings_count(lang)
percent = (total - todo) / total
y_values.append((lang, percent, total - todo, total))
print(f'{lang}: {total - todo}/{total} translated, {percent * 100:.2f}%')
y_values.sort(key=lambda x: 1.0 - x[1])
y_values.reverse()
plt.figure().set_figwidth(15)
plt.barh([x[0] for x in y_values], [x[2] for x in y_values])
plt.xlabel('Strings Translated')
plt.ylabel('Language')
plt.title('Translation Progress')
plt.savefig(lproj_base / 'stats.png')
Binary file added res/stats.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f6a9fa6

Please sign in to comment.