-
Notifications
You must be signed in to change notification settings - Fork 1
Add script to pull Transifex translations #464
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
Conversation
Pull Request Review: Add script to pull Transifex translationsSummaryThis PR adds automation for pulling translation files from Transifex, which is a good improvement over the previous manual process. The script is generally well-structured, but there are several issues that should be addressed. Critical Issues1. Missing Newline at End of File (.tx/config:8)Issue: The .tx/config file is missing a newline at the end, which violates POSIX standards and can cause issues with some tools. Fix: Add a newline at the end of the file. Code Quality and Best Practices2. Unsafe Use of find -exec mv (Line 21)Issue: The command at line 21 could fail silently if files already exist in the destination, and the OR true swallows all errors. Location: scripts/pull-translations.sh:21 Recommendation: Use a while loop with better error handling to avoid silently ignoring move failures. 3. Inconsistent Error HandlingIssue: The script uses set -e but then uses OR true and redirects stderr to /dev/null in multiple places, which can mask real errors. Locations:
Recommendation: Be more selective about which errors to suppress. Consider using set +e around specific commands where you expect and handle failures explicitly. 4. Race Condition in Directory Deletion (Lines 116-123)Issue: The script collects directories in an array but does not sort them depth-first, which could cause issues if nested directories are processed out of order. Recommendation: Add reverse sort to ensure deeper directories are processed first. 5. AWK Script Could Be More Robust (Lines 81-91)Issue: The AWK script modifies XML files but does not validate that they are well-formed before or after processing. Recommendation: Add basic XML validation before processing files. Performance Considerations6. Multiple Passes Over FilesystemIssue: The script makes multiple separate passes with find commands. Assessment: Given that this is a one-time operation per pull, the performance impact is minimal. The current approach is more readable and maintainable. Security Concerns7. Path Injection Risk (Minor)Issue: While variables are properly quoted, the script does not validate that RES_DIR exists and is within the expected location before performing operations. Location: scripts/pull-translations.sh:7 Recommendation: Add validation to ensure the script is run from the project root. 8. No Validation of Transifex CLI OutputIssue: The script runs tx pull -a but does not check if it succeeded or if the files pulled are valid. Location: scripts/pull-translations.sh:26 Recommendation: Add error checking for the Transifex command. Documentation9. Strong Documentation in READMEPositive: The README.md additions are clear and helpful, providing step-by-step instructions for installing Transifex CLI, authenticating, and running the script. 10. Script Could Use More CommentsSuggestion: While the script is reasonably self-documenting, adding comments for the complex regex and AWK sections would help future maintainers. Test Coverage11. No Automated TestsIssue: There are no tests for this script. Consider adding a dry-run mode that shows what would be changed without making changes. Minor Improvements12. Hardcoded ValuesLocation: Lines 41-59 contain hardcoded language code mappings. Suggestion: Consider extracting these to a configuration file or associative array at the top of the script for easier maintenance. 13. Progress VisibilityPositive: The script has good progress output with counts at each stage. This is excellent for debugging and user feedback. Summary of RecommendationsMust Fix:
Should Fix: Nice to Have: Overall AssessmentThis is a solid contribution that improves the translation workflow. The script is well-structured with good user feedback. The main concerns are around error handling and validation. With the recommended fixes, this will be production-ready. Recommendation: Approve with minor changes requested |
Pull Request Review - PR #464SummaryThis PR adds a comprehensive script for pulling Android translations from Transifex with automatic cleanup and normalization. Overall, this is a well-structured and valuable addition to the project's localization workflow. The code quality is high, with good error handling and clear documentation. ✅ StrengthsCode Quality
Documentation
Functionality
🔍 Potential Issues & Suggestions1. Edge Case: Array handling in directory cleanup (Line 207)for dir in $(printf '%s\n' "${dirs_to_check[@]}" | sort -u | sort -r); doIssue: If Suggestion: Add a check before iterating to prevent issues with empty arrays. 2. Potential data loss concern (Lines 125-127)values-b+pt+PT|values-pt_PT)
echo " Removing: $dir_name"
rm -rf "$dir" && REMOVED_COUNT=$((REMOVED_COUNT + 1))Concern: The script unconditionally deletes Portuguese-Portugal translations with Suggestions:
3. XML validation is basic (Lines 70-78)Issue: The validation only checks for opening/closing tags but won't catch malformed XML inside the file. Suggestion: Consider using 4. Merge conflicts in rename_or_merge (Lines 47-52)Issue: If a file with the same name exists in the destination, Suggestion: Add 🔒 Security Considerations✅ Good Practices
|
|
@ben-kaufman can you please merge with master, that will fix the e2e tests runs |
ovitrif
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👏🏻
Pull Request Review: Add script to pull Transifex translationsOverall AssessmentThis is a well-structured PR that adds automation for pulling and normalizing translations from Transifex. The script is comprehensive and handles edge cases well. Below are detailed findings across different areas. Code Quality and Best Practices ⭐Strengths:
Areas for Improvement:
Potential Bugs or Issues 🐛
Performance Considerations ⚡
Security Concerns 🔒Good Security Practices:
Recommendations:
Test Coverage 🧪Missing:
Recommendations:
Documentation 📝Strengths:
Suggestions:
Additional Observations
Recommendations SummaryHigh Priority:
Medium Priority:
Low Priority:
ConclusionThis is a solid, production-ready script with good error handling and clear logic. The issues identified are mostly minor improvements rather than blocking problems. The automation will significantly improve the translation workflow. Recommendation: Approve with minor suggestions ✅ Great work on the thorough error handling and edge case management! |
Adds a script to pull the latest Android translation files from Transifex and adjust the folders and format to match the project.
Note: Diffs in the strings files are due to formatting of the last line or new strings which were translated.