Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
78ff543
All strings are fetched from *.properties files
jacalata Apr 30, 2024
7424d8b
clean out unused strings
jacalata May 3, 2024
8f9b9a9
clarify comment
jacalata May 6, 2024
16360ae
more global_options settings
jacalata May 6, 2024
b4876b9
extracted additional strings
jacalata May 6, 2024
c1ce84e
black and mypy
jacalata May 7, 2024
7653828
tests passing
jacalata May 7, 2024
2a0a714
Update tabcmd/execution/global_options.py
jacalata Jul 31, 2025
71b8be5
Update tabcmd/locales/en/tabcmd_messages_en.properties
jacalata Jul 31, 2025
27bb2b1
Update tabcmd/commands/datasources_and_workbooks/delete_command.py
jacalata Jul 31, 2025
c17395c
Merge branch 'development' into jac/collect-strings
jacalata Jul 31, 2025
0eb395f
Update tabcmd/execution/global_options.py
jacalata Jul 31, 2025
739e008
Update tabcmd_messages_en.properties
jacalata Jul 31, 2025
06865f5
Update global_options.py
jacalata Jul 31, 2025
a30cf6b
Update tabcmd/execution/parent_parser.py
jacalata Jul 31, 2025
709ffd2
Update tabcmd/execution/parent_parser.py
jacalata Jul 31, 2025
1eae3f9
Update tabcmd/locales/en/tabcmd_messages_en.properties
jacalata Jul 31, 2025
7110f80
format w black
jacalata Jul 31, 2025
c05ae06
Add script for double-checking messages found in source code vs prope…
bcantoni Aug 1, 2025
9f9a4e1
Add a "launching" message which was referenced everywhere
bcantoni Aug 1, 2025
baa658a
document loc process, fix misreferenced string ids
jacalata Aug 5, 2025
eaee839
format
jacalata Aug 5, 2025
5c3b07f
do a one-time cleanup to get rid of unused strings
jacalata Aug 5, 2025
042b9d0
move tabcmd.x files back into tabcmd strings
jacalata Aug 5, 2025
5f83bf3
extract all strings in --help or exceptions for loc
jacalata Aug 5, 2025
30f2efe
Last hardcoded strings
jacalata Aug 5, 2025
93c0c59
oops indent
jacalata Aug 5, 2025
08de77b
string formatting bug
jacalata Aug 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions bin/i18n/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

### Strings and localization

New text should not be hardcoded into the python, but added to tabcmd/locales/en/extra.properties. This file can be given to the translation team and they will return a copy for each other language. Until then, the english string will be used as a fallback.

To handle localizing text we used the python standard library tool [gettext](https://docs.python.org/3/library/gettext.html). This expects .mo files. I couldn't find a tool that transformed .properties -> .mo directly so we go through .po format.
(FYI: to read mo files for debugging use https://poedit.net/download)


These steps are separated for easier troubleshooting: each step is idempotent and will overwrite the existing output. More details about implementation are in the script code at dodo.py

1. convert strings from .properties files to .mo for bundling
This step combines the .properties files into a single file, discarding any strings that are not present in code and normalizing curly quotes and unrecognized characters in the strings it keeps. (These files are separate because they are pulled from separate translation sources internally.)
> python -m doit combine_property_files

2. Convert the combined .properties file into a .po file (these are human readable)
> python -m doit po

3. Convert the .po files into .mo files (these are not human readable)
This also checks the .mo files for validity by loading them with gettext
> python -m doit mo

## Optional reorganization task

Move all strings from extra.properties to the bottom of tabcmd_messages_xx.properties:
> python -m doit move_tabcmd_strings

This consolidates all strings into the main tabcmd_messages files and clears the extra.properties files.
25 changes: 25 additions & 0 deletions bin/i18n/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
i18n utilities for tabcmd localization.

This package contains tools for checking and processing localization strings.
"""

from .check_strings import (
find_python_files,
extract_string_keys_from_file,
load_properties_files,
load_properties_file,
find_missing_strings,
check_build_mode,
check_dev_mode
)

__all__ = [
'find_python_files',
'extract_string_keys_from_file',
'load_properties_files',
'load_properties_file',
'find_missing_strings',
'check_build_mode',
'check_dev_mode'
]
Loading