Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork39
Add function to compare translated strings between two commits#138
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
guilhermesrc wants to merge8 commits intopython:3.12Choose a base branch fromguilhermesrc:3.12
base:3.12
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Changes fromall commits
Commits
Show all changes
8 commits Select commitHold shift + click to select a range
240fb08
Add function to compare translated strings between two commits
guilhermesrce608405
Merge branch 'python:3.12' into 3.12
guilhermesrcc1a0135
testando outra forma de obter as strings do commit
guilhermesrcf5e5051
retirando o contexto
guilhermesrcbbc6015
mudando a forma como é pego o commit strings
guilhermesrca77da15
refatorando run_os_command e get_translated_strings_between_commits.py
guilhermesrc1ad887c
retirando dependencia não usada
guilhermesrc964d587
alterando biblioteca de manipulação com o sistema e retirando try exc…
guilhermesrcFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions.github/scripts/get_translated_strings_between_commits.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import subprocess | ||
from pathlib import Path | ||
import re | ||
absolute_path = Path(__file__).resolve().parents[2] | ||
pattern_translated_strings = r'Translated:\s+(\d+)' | ||
def run_os_command(command): | ||
try: | ||
return subprocess.check_output(command, shell=True, text=True) | ||
except subprocess.CalledProcessError as e: | ||
print(f"Error executing command '{command}': {e}") | ||
return None | ||
def get_translated_commit_strings(commit_hash): | ||
run_os_command(f"git switch --force {commit_hash} --detach") | ||
pocount_of_commit = run_os_command(f"pocount {absolute_path}/*.po {absolute_path}/**/*.po") | ||
all_translated_results = re.findall(pattern_translated_strings, pocount_of_commit, re.DOTALL) | ||
total_of_translated_commit_strings = int(all_translated_results[-1]) | ||
return total_of_translated_commit_strings | ||
def get_difference_between_translated_commits_strings(commit_hash1, commit_hash2): | ||
commit_hash1_count = get_translated_commit_strings(commit_hash1) | ||
commit_hash2_count = get_translated_commit_strings(commit_hash2) | ||
return commit_hash1_count - commit_hash2_count |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.