Skip to content

Commit bb29476

Browse files
committed
Merge branch 'release/v8.36'
2 parents 0bb502c + 9caa20c commit bb29476

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1225
-472
lines changed

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,8 @@ indent_size = 2
292292
end_of_line = lf
293293
[*.{cmd,bat}]
294294
end_of_line = crlf
295+
296+
# YAML files
297+
[*.{yml,yaml}]
298+
indent_size = 2
299+
end_of_line = lf
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Localization Check
2+
on:
3+
push:
4+
branches: [ develop ]
5+
paths:
6+
- 'src/Resources/Locales/**'
7+
- 'README.md'
8+
workflow_dispatch:
9+
workflow_call:
10+
11+
jobs:
12+
localization-check:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20.x'
23+
24+
- name: Install dependencies
25+
26+
27+
- name: Run localization check
28+
run: node build/scripts/localization-check.js
29+
30+
- name: Commit changes
31+
run: |
32+
git config --global user.name 'github-actions[bot]'
33+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
34+
if [ -n "$(git status --porcelain)" ]; then
35+
git add README.md TRANSLATION.md
36+
git commit -m 'doc: Update translation status and missing keys'
37+
git push
38+
else
39+
echo "No changes to commit"
40+
fi
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ ehthumbs_vista.db
2323

2424
bin/
2525
obj/
26+
# ignore ci node files
27+
node_modules/
28+
package.json
29+
package-lock.json
2630

2731
build/resources/
2832
build/SourceGit/
@@ -32,4 +36,4 @@ build/*.tar.gz
3236
build/*.deb
3337
build/*.rpm
3438
build/*.AppImage
35-
SourceGit.app/
39+
SourceGit.app/

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# SourceGit
1+
# SourceGit - Opensource Git GUI client.
22

3-
Opensource Git GUI client.
3+
![stars](https://img.shields.io/github/stars/sourcegit-scm/sourcegit.svg) ![forks](https://img.shields.io/github/forks/sourcegit-scm/sourcegit.svg) ![license](https://img.shields.io/github/license/sourcegit-scm/sourcegit.svg) ![latest](https://img.shields.io/github/v/release/sourcegit-scm/sourcegit.svg) ![downloads](https://img.shields.io/github/downloads/sourcegit-scm/sourcegit/total)
44

55
## Highlights
66

@@ -41,6 +41,10 @@ Opensource Git GUI client.
4141
> [!WARNING]
4242
> **Linux** only tested on **Debian 12** on both **X11** & **Wayland**.
4343
44+
## Translation Status
45+
46+
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.95%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-90.36%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-93.52%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.10%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
47+
4448
## How to Use
4549

4650
**To use this tool, you need to install Git(>=2.23.0) first.**
@@ -81,6 +85,7 @@ For **macOS** users:
8185
* Make sure your mac trusts all software from anywhere. For more information, search `spctl --master-disable`.
8286
* Make sure [git-credential-manager](https://github.com/git-ecosystem/git-credential-manager/releases) is installed on your mac.
8387
* You may need to run `sudo xattr -cr /Applications/SourceGit.app` to make sure the software works.
88+
* You can run `echo $PATH > ~/Library/Application\ Support/SourceGit/PATH` to generate a custom PATH env file to introduce `PATH` env to SourceGit.
8489

8590
For **Linux** users:
8691

SourceGit.sln

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
1616
.github\workflows\ci.yml = .github\workflows\ci.yml
1717
.github\workflows\package.yml = .github\workflows\package.yml
1818
.github\workflows\release.yml = .github\workflows\release.yml
19+
.github\workflows\localization-check.yml = .github\workflows\localization-check.yml
1920
EndProjectSection
2021
EndProject
2122
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{49A7C2D6-558C-4FAA-8F5D-EEE81497AED7}"

TRANSLATION.md

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
### de_DE.axaml: 98.95%
2+
3+
4+
<details>
5+
<summary>Missing Keys</summary>
6+
7+
- Text.Configure.Git.EnableSignOff
8+
- Text.Configure.IssueTracker.AddSampleGitLabIssue
9+
- Text.Configure.IssueTracker.AddSampleGitLabMergeRequest
10+
- Text.Preference.Advanced
11+
- Text.Preference.AI.AnalyzeDiffPrompt
12+
- Text.Preference.AI.GenerateSubjectPrompt
13+
- Text.WorkingCopy.ConfirmCommitWithoutFiles
14+
15+
</details>
16+
17+
### fr_FR.axaml: 90.36%
18+
19+
20+
<details>
21+
<summary>Missing Keys</summary>
22+
23+
- Text.About.Chart
24+
- Text.AIAssistant
25+
- Text.AIAssistant.Tip
26+
- Text.CherryPick.AppendSourceToMessage
27+
- Text.CherryPick.Mainline
28+
- Text.CherryPick.Mainline.Tips
29+
- Text.CommitCM.CherryPickMultiple
30+
- Text.CommitCM.SquashCommitsSinceThis
31+
- Text.CommitDetail.Info.WebLinks
32+
- Text.Configure.Git.DefaultRemote
33+
- Text.Configure.Git.EnableSignOff
34+
- Text.Configure.IssueTracker.AddSampleGitLabIssue
35+
- Text.Configure.IssueTracker.AddSampleGitLabMergeRequest
36+
- Text.ConfigureWorkspace
37+
- Text.ConfigureWorkspace.Color
38+
- Text.ConfigureWorkspace.Restore
39+
- Text.ConventionalCommit
40+
- Text.ConventionalCommit.BreakingChanges
41+
- Text.ConventionalCommit.ClosedIssue
42+
- Text.ConventionalCommit.Detail
43+
- Text.ConventionalCommit.Scope
44+
- Text.ConventionalCommit.ShortDescription
45+
- Text.ConventionalCommit.Type
46+
- Text.Diff.IgnoreWhitespace
47+
- Text.Discard.IncludeIgnored
48+
- Text.FileHistory.FileChange
49+
- Text.GitLFS.Locks.OnlyMine
50+
- Text.Histories.Header.AuthorTime
51+
- Text.Histories.Tips
52+
- Text.Histories.Tips.MacOS
53+
- Text.Histories.Tips.Prefix
54+
- Text.Hotkeys.Repo.CommitWithAutoStage
55+
- Text.Hotkeys.Repo.DiscardSelected
56+
- Text.MoveRepositoryNode
57+
- Text.MoveRepositoryNode.Target
58+
- Text.Preference.Advanced
59+
- Text.Preference.AI
60+
- Text.Preference.AI.AnalyzeDiffPrompt
61+
- Text.Preference.AI.ApiKey
62+
- Text.Preference.AI.GenerateSubjectPrompt
63+
- Text.Preference.AI.Model
64+
- Text.Preference.AI.Server
65+
- Text.Preference.General.ShowAuthorTime
66+
- Text.Preference.Integration
67+
- Text.Preference.Shell
68+
- Text.Preference.Shell.Type
69+
- Text.Preference.Shell.Path
70+
- Text.Repository.AutoFetching
71+
- Text.Repository.EnableReflog
72+
- Text.Repository.Search.InCurrentBranch
73+
- Text.ScanRepositories
74+
- Text.ScanRepositories.RootDir
75+
- Text.Squash.Into
76+
- Text.Stash.OnlyStagedChanges
77+
- Text.Stash.TipForSelectedFiles
78+
- Text.Statistics.Overview
79+
- Text.TagCM.CopyMessage
80+
- Text.Welcome.Move
81+
- Text.Welcome.ScanDefaultCloneDir
82+
- Text.WorkingCopy.CommitTip
83+
- Text.WorkingCopy.CommitWithAutoStage
84+
- Text.WorkingCopy.ConfirmCommitWithoutFiles
85+
- Text.Workspace
86+
- Text.Workspace.Configure
87+
88+
</details>
89+
90+
### pt_BR.axaml: 93.52%
91+
92+
93+
<details>
94+
<summary>Missing Keys</summary>
95+
96+
- Text.About.Chart
97+
- Text.AIAssistant
98+
- Text.AIAssistant.Tip
99+
- Text.CherryPick.AppendSourceToMessage
100+
- Text.CherryPick.Mainline
101+
- Text.CherryPick.Mainline.Tips
102+
- Text.CommitCM.CherryPickMultiple
103+
- Text.CommitCM.SquashCommitsSinceThis
104+
- Text.CommitDetail.Info.ContainsIn
105+
- Text.CommitDetail.Info.ContainsIn.Title
106+
- Text.CommitDetail.Info.WebLinks
107+
- Text.Configure.Git.DefaultRemote
108+
- Text.Configure.Git.EnableSignOff
109+
- Text.Configure.IssueTracker.AddSampleGitLabIssue
110+
- Text.Configure.IssueTracker.AddSampleGitLabMergeRequest
111+
- Text.ConfigureWorkspace
112+
- Text.ConfigureWorkspace.Color
113+
- Text.ConfigureWorkspace.Restore
114+
- Text.ConventionalCommit
115+
- Text.ConventionalCommit.BreakingChanges
116+
- Text.ConventionalCommit.ClosedIssue
117+
- Text.ConventionalCommit.Detail
118+
- Text.ConventionalCommit.Scope
119+
- Text.ConventionalCommit.ShortDescription
120+
- Text.ConventionalCommit.Type
121+
- Text.CopyAllText
122+
- Text.Discard.IncludeIgnored
123+
- Text.FileHistory.FileContent
124+
- Text.FileHistory.FileChange
125+
- Text.GitLFS.Locks.OnlyMine
126+
- Text.MoveRepositoryNode
127+
- Text.MoveRepositoryNode.Target
128+
- Text.Preference.Advanced
129+
- Text.Push.CheckSubmodules
130+
- Text.Squash.Into
131+
- Text.Stash.OnlyStagedChanges
132+
- Text.Stash.TipForSelectedFiles
133+
- Text.Statistics.Overview
134+
- Text.TagCM.CopyMessage
135+
- Text.WorkingCopy.Staged.UnstageAll
136+
- Text.WorkingCopy.Unstaged
137+
- Text.WorkingCopy.Unstaged.Stage
138+
- Text.WorkingCopy.Unstaged.StageAll
139+
140+
</details>
141+
142+
### ru_RU.axaml: 100.00%
143+
144+
145+
<details>
146+
<summary>Missing Keys</summary>
147+
148+
149+
150+
</details>
151+
152+
### zh_CN.axaml: 99.10%
153+
154+
155+
<details>
156+
<summary>Missing Keys</summary>
157+
158+
- Text.Preference.AI
159+
- Text.Preference.AI.AnalyzeDiffPrompt
160+
- Text.Preference.AI.ApiKey
161+
- Text.Preference.AI.GenerateSubjectPrompt
162+
- Text.Preference.AI.Model
163+
- Text.Preference.AI.Server
164+
165+
</details>
166+
167+
### zh_TW.axaml: 100.00%
168+
169+
170+
<details>
171+
<summary>Missing Keys</summary>
172+
173+
174+
175+
</details>

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.35
1+
8.36

build/scripts/localization-check.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
const fs = require('fs-extra');
2+
const path = require('path');
3+
const xml2js = require('xml2js');
4+
5+
const repoRoot = path.join(__dirname, '../../');
6+
const localesDir = path.join(repoRoot, 'src/Resources/Locales');
7+
const enUSFile = path.join(localesDir, 'en_US.axaml');
8+
const outputFile = path.join(repoRoot, 'TRANSLATION.md');
9+
const readmeFile = path.join(repoRoot, 'README.md');
10+
11+
const parser = new xml2js.Parser();
12+
13+
async function parseXml(filePath) {
14+
const data = await fs.readFile(filePath);
15+
return parser.parseStringPromise(data);
16+
}
17+
18+
async function calculateTranslationRate() {
19+
const enUSData = await parseXml(enUSFile);
20+
const enUSKeys = new Set(enUSData.ResourceDictionary['x:String'].map(item => item.$['x:Key']));
21+
22+
const translationRates = [];
23+
const badges = [];
24+
25+
const files = (await fs.readdir(localesDir)).filter(file => file !== 'en_US.axaml' && file.endsWith('.axaml'));
26+
27+
// Add en_US badge first
28+
badges.push(`[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md)`);
29+
30+
for (const file of files) {
31+
const filePath = path.join(localesDir, file);
32+
const localeData = await parseXml(filePath);
33+
const localeKeys = new Set(localeData.ResourceDictionary['x:String'].map(item => item.$['x:Key']));
34+
35+
const missingKeys = [...enUSKeys].filter(key => !localeKeys.has(key));
36+
const translationRate = ((enUSKeys.size - missingKeys.length) / enUSKeys.size) * 100;
37+
38+
translationRates.push(`### ${file}: ${translationRate.toFixed(2)}%\n`);
39+
translationRates.push(`<details>\n<summary>Missing Keys</summary>\n\n${missingKeys.map(key => `- ${key}`).join('\n')}\n\n</details>`);
40+
41+
// Add badges
42+
const locale = file.replace('.axaml', '').replace('_', '__');
43+
const badgeColor = translationRate === 100 ? 'brightgreen' : translationRate >= 75 ? 'yellow' : 'red';
44+
badges.push(`[![${locale}](https://img.shields.io/badge/${locale}-${translationRate.toFixed(2)}%25-${badgeColor})](TRANSLATION.md)`);
45+
}
46+
47+
console.log(translationRates.join('\n\n'));
48+
49+
await fs.writeFile(outputFile, translationRates.join('\n\n') + '\n', 'utf8');
50+
51+
// Update README.md
52+
let readmeContent = await fs.readFile(readmeFile, 'utf8');
53+
const badgeSection = `## Translation Status\n\n${badges.join(' ')}`;
54+
console.log(badgeSection);
55+
readmeContent = readmeContent.replace(/## Translation Status\n\n.*\n\n/, badgeSection + '\n\n');
56+
await fs.writeFile(readmeFile, readmeContent, 'utf8');
57+
}
58+
59+
calculateTranslationRate().catch(err => console.error(err));

src/Commands/Add.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public Add(string repo, bool includeUntracked)
1111
Context = repo;
1212
Args = includeUntracked ? "add ." : "add -u .";
1313
}
14-
14+
1515
public Add(string repo, List<Models.Change> changes)
1616
{
1717
WorkingDirectory = repo;

src/Commands/Command.cs

+4
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ private ProcessStartInfo CreateGitStartInfo()
195195
if (OperatingSystem.IsLinux())
196196
start.Environment.Add("LANG", "en_US.UTF-8");
197197

198+
// Fix macOS `PATH` env
199+
if (OperatingSystem.IsMacOS() && !string.IsNullOrEmpty(Native.OS.CustomPathEnv))
200+
start.Environment.Add("PATH", Native.OS.CustomPathEnv);
201+
198202
// Force using this app as git editor.
199203
switch (Editor)
200204
{

0 commit comments

Comments
 (0)