Skip to content

Commit c6a2071

Browse files
committed
Merge branch 'master' of https://github.com/j6t/git-gui
* 'master' of https://github.com/j6t/git-gui: git-gui: treat the message template file as a built file git-gui: heed core.commentChar/commentString git-gui: po/README: update repository location and maintainer
2 parents 1ee85f0 + 309bb87 commit c6a2071

File tree

6 files changed

+23
-2732
lines changed

6 files changed

+23
-2732
lines changed

git-gui/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ dist-version:
322322
@echo $(GITGUI_VERSION) > $(TARDIR)/version
323323

324324
clean::
325-
$(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg
325+
$(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg $(PO_TEMPLATE)
326326
$(RM_RF) GIT-VERSION-FILE GIT-GUI-VARS
327327
ifdef GITGUI_MACOSXAPP
328328
$(RM_RF) 'Git Gui.app'* git-gui

git-gui/git-gui.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,12 @@ proc apply_config {} {
880880
color::sync_with_theme
881881
}
882882
}
883+
884+
global comment_string
885+
set comment_string [get_config core.commentstring]
886+
if {$comment_string eq {}} {
887+
set comment_string [get_config core.commentchar]
888+
}
883889
}
884890

885891
set default_config(branch.autosetupmerge) true
@@ -890,6 +896,8 @@ set default_config(merge.summary) false
890896
set default_config(merge.verbosity) 2
891897
set default_config(user.name) {}
892898
set default_config(user.email) {}
899+
set default_config(core.commentchar) "#"
900+
set default_config(core.commentstring) {}
893901

894902
set default_config(gui.encoding) [encoding system]
895903
set default_config(gui.matchtrackingbranch) false

git-gui/lib/commit.tcl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ You must stage at least 1 file before you can commit.
211211
# Strip trailing whitespace
212212
regsub -all -line {[ \t\r]+$} $msg {} msg
213213
# Strip comment lines
214-
regsub -all {(^|\n)#[^\n]*} $msg {\1} msg
214+
global comment_string
215+
set cmt_rx [strcat {(^|\n)} [regsub -all {\W} $comment_string {\\&}] {[^\n]*}]
216+
regsub -all $cmt_rx $msg {\1} msg
215217
# Strip leading empty lines
216218
regsub {^\n*} $msg {} msg
217219
# Compress consecutive empty lines

git-gui/po/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.msg
22
*~
3+
/git-gui.pot

git-gui/po/README

Lines changed: 10 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ them.
2121
You would then need to clone the git-gui project repository and create
2222
a feature branch to begin working:
2323

24-
$ git clone git://repo.or.cz/git-gui.git
25-
$ cd git-gui.git
24+
$ git clone https://github.com/j6t/git-gui
25+
$ cd git-gui
2626
$ git checkout -b my-translation
2727

2828
The "git checkout" command creates a new branch to keep your work
@@ -47,6 +47,10 @@ language, you do not have to perform any step in this section, but keep
4747
reading, because we are covering the basics.
4848

4949
If you did not find your language, you would need to start one yourself.
50+
Generate po/git-gui.pot using
51+
52+
$ make po/git-gui.pot
53+
5054
Copy po/git-gui.pot file to po/af.po (replace "af" with the code for
5155
your language). Edit the first several lines to match existing *.po
5256
files to make it clear this is a translation table for git-gui project,
@@ -153,7 +157,7 @@ your patch series to the maintainer and the Git mailing list:
153157
$ git add po/af.po
154158
$ git commit -s -m 'git-gui: added Afrikaans translation.'
155159
$ git send-email --to '[email protected]' \
156-
--cc 'Pat Thoyts <[email protected]>' \
160+
--cc 'Johannes Sixt <[email protected]>' \
157161
--subject 'git-gui: Afrikaans translation' \
158162
master..
159163

@@ -169,18 +173,7 @@ In any case, make sure you are up to date before starting your work:
169173

170174
$ git checkout master
171175
$ git pull
172-
173-
In the former case, you will edit po/af.po (again, replace "af" with
174-
your language code), and after testing and updating the Last-Translator:
175-
and PO-Revision-Date: lines, "add/commit/push" as in the previous
176-
section.
177-
178-
By comparing "POT-Creation-Date:" line in po/git-gui.pot file and
179-
po/af.po file, you can tell if there are new messages that need to be
180-
translated. You would need the GNU gettext package to perform this
181-
step.
182-
183-
$ msgmerge -U po/af.po po/git-gui.pot
176+
$ make ALL_POFILES=po/af.po update-po
184177

185178
This updates po/af.po (again, replace "af" with your language
186179
code) so that it contains msgid lines (i.e. the original) that
@@ -200,52 +193,5 @@ watch out for:
200193
- New messages added to the software will have msgstr lines with empty
201194
strings. You would need to translate them.
202195

203-
The po/git-gui.pot file is updated by the internationalization
204-
coordinator from time to time. You _could_ update it yourself, but
205-
translators are discouraged from doing so because we would want all
206-
language teams to be working off of the same version of git-gui.pot.
207-
208-
****************************************************************
209-
210-
This section is a note to the internationalization coordinator, and
211-
translators do not have to worry about it too much.
212-
213-
The message template file po/git-gui.pot needs to be kept up to date
214-
relative to the software the translations apply to, and it is the
215-
responsibility of the internationalization coordinator.
216-
217-
When updating po/git-gui.pot file, however, _never_ run "msgmerge -U
218-
po/xx.po" for individual language translations, unless you are absolutely
219-
sure that there is no outstanding work on translation for language xx.
220-
Doing so will create unnecessary merge conflicts and force needless
221-
re-translation on translators. The translator however may not have access
222-
to the msgmerge tool, in which case the coordinator may run it for the
223-
translator as a service.
224-
225-
But mistakes do happen. Suppose a translation was based on an older
226-
version X, the POT file was updated at version Y and then msgmerge was run
227-
at version Z for the language, and the translator sent in a patch based on
228-
version X:
229-
230-
? translated
231-
/
232-
---X---Y---Z (master)
233-
234-
The coordinator could recover from such a mistake by first applying the
235-
patch to X, replace the translated file in Z, and then running msgmerge
236-
again based on the updated POT file and commit the result. The sequence
237-
would look like this:
238-
239-
$ git checkout X
240-
$ git am -s xx.patch
241-
$ git checkout master
242-
$ git checkout HEAD@{1} po/xx.po
243-
$ msgmerge -U po/xx.po po/git-gui.pot
244-
$ git commit -c HEAD@{1} po/xx.po
245-
246-
State in the message that the translated messages are based on a slightly
247-
older version, and msgmerge was run to incorporate changes to message
248-
templates from the updated POT file. The result needs to be further
249-
translated, but at least the messages that were updated by the patch that
250-
were not changed by the POT update will survive the process and do not
251-
need to be re-translated.
196+
After testing and updating the Last-Translator: and PO-Revision-Date:
197+
lines, "add/commit/push" as in the previous section.

0 commit comments

Comments
 (0)