Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 1 addition & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ python3 scripts/update_python_version.py v3.15.0 --keep-src

این اسکریپت نسخهٔ مشخص‌شدهٔ CPython را کلون می‌کند، قالب‌های gettext (`*.pot`) را از روی آن می‌سازد، فایل‌های `.po` موجود را با `msgmerge` به‌روزرسانی می‌کند، برای صفحات جدید فایل `.po` تازه می‌سازد و در پایان همهٔ فایل‌ها را با `msgfmt --check` صحت‌سنجی می‌کند. بعد از اجرای آن، خروجی را بازبینی کنید و اعتبارهای سربرگ را (در صورت نیاز با `scripts/update_po_headers.py`) به‌روزرسانی کنید.

## اولویت‌ها

اگر تازه‌کار هستید، اول روی فایل‌هایی تمرکز کنید که برای قرار گرفتن فارسی در «تغییردهندهٔ زبان» (language switcher) مستندات پایتون لازم‌اند:

- `bugs.po`
- همهٔ فایل‌های `tutorial/`
- `library/functions.po`
## مقدار ترجمه‌ی باقی‌مانده

با `python3 scripts/translation_status.py --only-incomplete` می‌توانید وضعیت دقیق هر فایل را ببینید.
26 changes: 22 additions & 4 deletions scripts/translation_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,31 @@ def file_stats(path: Path):
)


def collect_files(paths):
def collect_files(paths, exclude=None):
exclude = {Path(e).resolve() for e in (exclude or [])}
files = []

def is_excluded(path):
resolved = path.resolve()
return resolved in exclude or any(
parent in exclude for parent in resolved.parents
)

for arg in paths:
p = Path(arg)
if p.is_dir():
if is_excluded(p):
continue
for f in p.rglob("*.po"):
if any(part.startswith(".") for part in f.parts):
continue
if is_excluded(f):
continue
files.append(f)
elif p.suffix == ".po":
files.append(p)
if not is_excluded(p):
files.append(p)

return files


Expand All @@ -66,10 +80,14 @@ def main():
action="store_true",
help="Hide files that are already fully translated",
)
parser.add_argument(
"--exclude",
nargs="*",
help="Exclude files or directories from scan",
)
parser.add_argument("--format", choices=["text", "markdown", "csv"], default="text")
args = parser.parse_args()

files = collect_files(args.paths)
files = collect_files(args.paths, args.exclude)
if not files:
print("No .po files found.")
sys.exit(1)
Expand Down
Loading