(Arne Babenhauserheide)
2011-10-20: Added a copyright info and made translatable. Added a copyright info and made translatable.
diff --git a/site.py b/site.py
--- a/site.py
+++ b/site.py
@@ -43,6 +43,12 @@ without the interactivity).
"""
+__copyright__ = """Copyright 2011 Arne Babenhauserheide
+
+This software may be used and distributed according to the terms of the
+GNU General Public License version 2 or any later version.
+"""
+
import os
from os.path import join, isdir, isfile, basename, dirname
import shutil
@@ -53,6 +59,7 @@ import socket
import datetime
from mercurial import cmdutil
from mercurial import commands
+from mercurial.i18n import _
_staticidentifier = ".statichgrepo"
@@ -81,9 +88,9 @@ templates = {
"foot": "</body></html>",
"screenstyle": """ """,
"printstyle": """ """,
- "manifesthead": """<h2>Commit: <a href='../../commit/{hex}.html'>{hex}</a></h2>
+ "manifesthead": """<h2>""" + _("Commit")+""": <a href='../../commit/{hex}.html'>{hex}</a></h2>
<p>{desc}</p><p>{user}</p>
- <h2>Files in this revision</h2>"""
+ <h2>""" + _("Files in this revision") + "</h2>"
}
@@ -122,7 +129,7 @@ def writeoverview(ui, repo, target, name
overview.write(ui.popbuffer())
# add the full readme
- overview.write("<h2>Readme</h2>")
+ overview.write("<h2>"+_("Readme")+"</h2>")
overview.write(readme)
# finish the overview
@@ -350,7 +357,7 @@ def upload(ui, repo, target, ftpstring,
try:
ftp = ftplib.FTP(server, user, password, "", timeout)
except socket.timeout:
- ui.warn("connection to ", server, " timed out after ", timeout, " seconds.\n")
+ ui.warn(_("connection to "), server, _(" timed out after "), timeout, _(" seconds.\n"))
return
ui.status(ftp.getwelcome(), "\n")
@@ -370,7 +377,7 @@ def upload(ui, repo, target, ftpstring,
ftp.cwd(ftppath)
if not ftp.pwd() == "/" + ftppath:
- ui.warn("not in the correct ftp directory. Cowardly bailing out.\n")
+ ui.warn(_("not in the correct ftp directory. Cowardly bailing out.\n"))
return
#ftp.dir()
@@ -390,11 +397,11 @@ def upload(ui, repo, target, ftpstring,
sd = serverdirparts[0]
if sd and not sd in _ftpdircache and not sd in ftp.nlst():
try:
- ui.status("creating directory ", sd, "\n")
+ ui.status(_("creating directory "), sd, "\n")
ftp.mkd(sd)
_ftpdircache.add(sd)
except ftplib.error_perm, resp:
- ui.warn("could not create directory ", sd, ": " , resp, "\n")
+ ui.warn(_("could not create directory "), sd, ": " , resp, "\n")
else: _ftpdircache.add(sd)
for sdp in serverdirparts[1:]:
@@ -404,19 +411,19 @@ def upload(ui, repo, target, ftpstring,
#print ftp.nlst(sdold)
if sd and not sd in _ftpdircache and not sd in ftp.nlst(sdold):
try:
- ui.status("creating directory ", sd, "\n")
+ ui.status(_("creating directory "), sd, "\n")
ftp.mkd(sd)
_ftpdircache.add(sd)
except ftplib.error_perm, resp:
- ui.warn("could not create directory ", sd, ": " , resp, "\n")
+ ui.warn(_("could not create directory "), sd, ": " , resp, "\n")
else: _ftpdircache.add(sd)
if not serverfile in ftp.nlst(serverdir) or force:
if force:
- ui.status("uploading ", serverfile, " because I am forced to.\n")
+ ui.status(_("uploading "), serverfile, _(" because I am forced to.\n"))
else:
- ui.status("uploading ", serverfile, " because it is not yet online.\n")
+ ui.status(_("uploading "), serverfile, _(" because it is not yet online.\n"))
ftp.storbinary("STOR "+ serverfile, f)
else:
@@ -427,7 +434,7 @@ def upload(ui, repo, target, ftpstring,
localmtimestr = datetime.datetime.utcfromtimestamp(localmtime).strftime("%Y%m%d%H%M%S")
newer = int(localmtimestr) > int(ftpmtime)
if newer:
- ui.status("uploading ", serverfile, " because it is newer than the file on the FTP server.\n")
+ ui.status(_("uploading "), serverfile, _)" because it is newer than the file on the FTP server.\n"))
ftp.storbinary("STOR "+ serverfile, f)
@@ -435,7 +442,7 @@ def upload(ui, repo, target, ftpstring,
def staticsite(ui, repo, target=None, **opts):
"""Create a static copy of the repository and/or upload it to an FTP server."""
if repo.root == target:
- ui.warn("static target repo can’t be the current repo")
+ ui.warn(_("static target repo can’t be the current repo"))
return
# first: just create the site.
if not target: target = "static"