Skip to content

Make --lang parameter optional with auto-detection from PO files #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2025

Conversation

pescheck-bram
Copy link
Contributor

Summary

Makes the --lang parameter optional by implementing automatic language detection from PO file metadata and folder structure. This improves user experience by eliminating
the need to manually specify target languages when they can be automatically determined.

Changes

Core Functionality

  • Auto-detection from PO metadata: Reads Language field from PO file headers
  • Auto-detection from folder structure: Uses --folder-language to detect from directory names (e.g., locale/fr/, i18n/de/)
  • Fallback behavior: -l parameter still works as override when explicit control is needed

Code Changes

  • Moved --lang from required to optional in CLI argument parser
  • Simplified main logic to use existing LanguageDetector.validate_or_detect_languages() method
  • Updated help text and examples to show auto-detection as recommended approach

Documentation Updates

  • Updated README.md with auto-detection examples
  • Updated docs/usage.md to reflect optional nature of --lang
  • Updated CLI help text with new usage patterns

Bug Fixes

  • Fixed deprecated pkg_resources warning by migrating to importlib.metadata
  • Removed unused imports and fixed linting issues

@pescheck-bram pescheck-bram merged commit 6e541df into main Aug 14, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant