From 01774948d84794d1d9c216f9a6859d7f150815d5 Mon Sep 17 00:00:00 2001 From: James Moger Date: Fri, 15 Jun 2012 15:50:59 -0400 Subject: [PATCH] Externalized some more strings. Updated Spanish translation from eguervos. --- .../gitblit/wicket/GitBlitWebApp.properties | 34 +++++++++++++++- .../wicket/GitBlitWebApp_es.properties | 40 +++++++++++++++++-- src/com/gitblit/wicket/pages/BlamePage.html | 6 +-- .../gitblit/wicket/pages/CommitDiffPage.java | 2 +- .../wicket/pages/EditRepositoryPage.java | 12 +++--- .../wicket/pages/GravatarProfilePage.html | 2 +- .../wicket/pages/RepositoriesPage.java | 25 +++++++++++- src/com/gitblit/wicket/pages/RootPage.java | 3 +- .../wicket/panels/RepositoriesPanel.java | 9 ++--- src/com/gitblit/wicket/panels/UsersPanel.java | 6 +-- 10 files changed, 113 insertions(+), 26 deletions(-) diff --git a/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties index 83b716af..6d61cc33 100644 --- a/src/com/gitblit/wicket/GitBlitWebApp.properties +++ b/src/com/gitblit/wicket/GitBlitWebApp.properties @@ -276,4 +276,36 @@ gb.failedToSendProposal = Failed to send proposal! gb.userServiceDoesNotPermitAddUser = {0} does not permit adding a user account! gb.userServiceDoesNotPermitPasswordChanges = {0} does not permit password changes! gb.displayName = display name -gb.emailAddress = email address \ No newline at end of file +gb.emailAddress = email address +gb.errorAdminLoginRequired = Administration requires a login +gb.errorOnlyAdminMayCreateRepository = Only an administrator may create a repository +gb.errorOnlyAdminOrOwnerMayEditRepository = Only an administrator or the owner may edit a repository +gb.errorAdministrationDisabled = Administration is disabled +gb.lastNDays = last {0} days +gb.completeGravatarProfile = Complete profile on Gravatar.com +gb.none = none +gb.line = line +gb.content = content +gb.empty = empty +gb.inherited = inherited +gb.deleteRepository = Delete repository \"{0}\"? +gb.repositoryDeleted = Repository ''{0}'' deleted. +gb.repositoryDeleteFailed = Failed to delete repository ''{0}''! +gb.deleteUser = Delete user \"{0}\"? +gb.userDeleted = User ''{0}'' deleted. +gb.userDeleteFailed = Failed to delete user ''{0}''! +gb.time.justNow = just now +gb.time.yesterday = yesterday +gb.time.minsAgo = {0} mins ago +gb.time.hoursAgo = {0} hours ago +gb.time.daysAgo = {0} days ago +gb.time.weeksAgo = {0} weeks ago +gb.time.monthsAgo = {0} months ago +gb.time.oneYearAgo = 1 year ago +gb.time.yearsAgo = {0} years ago +gb.duration.oneDay = 1 day +gb.duration.days = {0} days +gb.duration.oneMonth = 1 month +gb.duration.months = {0} months +gb.duration.oneYear = 1 year +gb.duration.years = {0} years diff --git a/src/com/gitblit/wicket/GitBlitWebApp_es.properties b/src/com/gitblit/wicket/GitBlitWebApp_es.properties index 47e151be..fb84e925 100644 --- a/src/com/gitblit/wicket/GitBlitWebApp_es.properties +++ b/src/com/gitblit/wicket/GitBlitWebApp_es.properties @@ -38,7 +38,7 @@ gb.tickets = Tickets gb.pageFirst = Primera gb.pagePrevious Anterior gb.pageNext = Siguiente -gb.head = PRINCIPAL +gb.head = HEAD gb.blame = Acuse gb.login = Idenfiticarse gb.logout = Salir @@ -131,8 +131,8 @@ gb.registrations = Registros de federaci\u00F3n gb.sendProposal = Proponer gb.status = Estado gb.origin = Origen -gb.headRef = Rama por defecto (PRINCIPAL) -gb.headRefDescription = Cambiar la Ref. a la que apunta PRINCIPAL ej. refs/heads/master +gb.headRef = Rama por defecto (HEAD) +gb.headRefDescription = Cambiar la Ref. a la que apunta HEAD ej. refs/heads/master gb.federationStrategy = Estrategia de federaci\u00F3n gb.federationRegistration = Registro de federaci\u00F3n gb.federationResults = Resultados de recibos federados @@ -276,4 +276,36 @@ gb.failedToSendProposal = /u00A1Fallo al enviar la propuesta! gb.userServiceDoesNotPermitAddUser = \u00A1{0} no permite a\u00F1adir una cuenta de usuario! gb.userServiceDoesNotPermitPasswordChanges = \u00A1{0} no permite cambio de contrase\u00F1a! gb.displayName = Nombre -gb.emailAddress = Direcci\u00F3n de correo \ No newline at end of file +gb.emailAddress = Direcci\u00F3n de correo +gb.errorAdminLoginRequired = La administración requiere identificarse +gb.errorOnlyAdminMayCreateRepository = Sólo un administrador puede crear un repositorio +gb.errorOnlyAdminOrOwnerMayEditRepository = Sólo un administrador o el propietario puede editar un repositorio +gb.errorAdministrationDisabled = La administración está desactivada +gb.lastNDays = \u00FAltimos {0} d\u00EDas +gb.completeGravatarProfile = Perfil completo en Gravatar.com +gb.none = nadie +gb.line = Línea +gb.content = Contenido +gb.empty = vacio +gb.inherited = inherited +gb.deleteRepository = \u00BFBorrar el repositorio \"{0}\"? +gb.repositoryDeleted = Repositorio ''{0}'' borrado. +gb.repositoryDeleteFailed = \u00A1Fallo al borrar el repositorio ''{0}''! +gb.deleteUser = Delete user \"{0}\"? +gb.userDeleted = User ''{0}'' deleted. +gb.userDeleteFailed = Failed to delete user ''{0}''! +gb.time.justNow = just now +gb.time.yesterday = ayer +gb.time.minsAgo = hace {0} min +gb.time.hoursAgo = hace {0} horas +gb.time.daysAgo = hace {0} d\u00EDas +gb.time.weeksAgo = hace {0} semanas +gb.time.monthsAgo = hace {0} meses +gb.time.oneYearAgo = hace 1 a\u00F1o +gb.time.yearsAgo = hace {0} a\u00F1os +gb.duration.oneDay = 1 d\u00EDa +gb.duration.days = {0} d\u00EDas +gb.duration.oneMonth = 1 mes +gb.duration.months = {0} meses +gb.duration.oneYear = 1 a\u00F1o +gb.duration.years = {0} a\u00F1os \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/BlamePage.html b/src/com/gitblit/wicket/pages/BlamePage.html index ccbfcecb..9391eaf0 100644 --- a/src/com/gitblit/wicket/pages/BlamePage.html +++ b/src/com/gitblit/wicket/pages/BlamePage.html @@ -22,9 +22,9 @@ - - - + + + diff --git a/src/com/gitblit/wicket/pages/CommitDiffPage.java b/src/com/gitblit/wicket/pages/CommitDiffPage.java index c6c9fd7c..cee065bb 100644 --- a/src/com/gitblit/wicket/pages/CommitDiffPage.java +++ b/src/com/gitblit/wicket/pages/CommitDiffPage.java @@ -59,7 +59,7 @@ public class CommitDiffPage extends RepositoryPage { // commit page links if (parents.size() == 0) { - add(new Label("parentLink", "none")); + add(new Label("parentLink", getString("gb.none"))); } else { add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitDiffPage.class, newCommitParameter(parents.get(0)))); diff --git a/src/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/com/gitblit/wicket/pages/EditRepositoryPage.java index 572f650d..a6f6af05 100644 --- a/src/com/gitblit/wicket/pages/EditRepositoryPage.java +++ b/src/com/gitblit/wicket/pages/EditRepositoryPage.java @@ -371,10 +371,10 @@ public class EditRepositoryPage extends RootSubPage { form.add(teamsPalette); form.add(federationSetsPalette); form.add(preReceivePalette); - form.add(new BulletListPanel("inheritedPreReceive", "inherited", GitBlit.self() + form.add(new BulletListPanel("inheritedPreReceive", getString("gb.inherited"), GitBlit.self() .getPreReceiveScriptsInherited(repositoryModel))); form.add(postReceivePalette); - form.add(new BulletListPanel("inheritedPostReceive", "inherited", GitBlit.self() + form.add(new BulletListPanel("inheritedPostReceive", getString("gb.inherited"), GitBlit.self() .getPostReceiveScriptsInherited(repositoryModel))); WebMarkupContainer customFieldsSection = new WebMarkupContainer("customFieldsSection"); @@ -414,13 +414,13 @@ public class EditRepositoryPage extends RootSubPage { if (authenticateAdmin) { if (user == null) { // No Login Available - error("Administration requires a login", true); + error(getString("gb.errorAdminLoginRequired"), true); } if (isCreate) { // Create Repository if (!user.canAdmin) { // Only Administrators May Create - error("Only an administrator may create a repository", true); + error(getString("gb.errorOnlyAdminMayCreateRepository"), true); } } else { // Edit Repository @@ -431,14 +431,14 @@ public class EditRepositoryPage extends RootSubPage { } else { if (!model.owner.equalsIgnoreCase(user.username)) { // User is not an Admin nor Owner - error("Only an administrator or the owner may edit a repository", true); + error(getString("gb.errorOnlyAdminOrOwnerMayEditRepository"), true); } } } } } else { // No Administration Permitted - error("Administration is disabled", true); + error(getString("gb.errorAdministrationDisabled"), true); } } diff --git a/src/com/gitblit/wicket/pages/GravatarProfilePage.html b/src/com/gitblit/wicket/pages/GravatarProfilePage.html index 2a83de73..0cc0f1fc 100644 --- a/src/com/gitblit/wicket/pages/GravatarProfilePage.html +++ b/src/com/gitblit/wicket/pages/GravatarProfilePage.html @@ -13,7 +13,7 @@

- Complete profile on Gravatar.com + [Complete profile on Gravatar.com]

diff --git a/src/com/gitblit/wicket/pages/RepositoriesPage.java b/src/com/gitblit/wicket/pages/RepositoriesPage.java index 40d1a652..98dade67 100644 --- a/src/com/gitblit/wicket/pages/RepositoriesPage.java +++ b/src/com/gitblit/wicket/pages/RepositoriesPage.java @@ -17,6 +17,7 @@ package com.gitblit.wicket.pages; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.InputStream; import java.io.InputStreamReader; import java.text.MessageFormat; @@ -26,6 +27,7 @@ import org.apache.wicket.Component; import org.apache.wicket.PageParameters; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.resource.ContextRelativeResource; +import org.apache.wicket.util.resource.ResourceStreamNotFoundException; import org.eclipse.jgit.lib.Constants; import com.gitblit.GitBlit; @@ -138,13 +140,34 @@ public class RepositoriesPage extends RootPage { } private String readDefaultMarkdown(String file) { + String content = readDefaultMarkdown(file, getLanguageCode()); + if (StringUtils.isEmpty(content)) { + content = readDefaultMarkdown(file, null); + } + return content; + } + + private String readDefaultMarkdown(String file, String lc) { + if (!StringUtils.isEmpty(lc)) { + // convert to file_lc.mkd + file = file.substring(0, file.lastIndexOf('.')) + "_" + lc + file.substring(file.lastIndexOf('.')); + } String message; - try { + try { ContextRelativeResource res = WicketUtils.getResource(file); InputStream is = res.getResourceStream().getInputStream(); InputStreamReader reader = new InputStreamReader(is, Constants.CHARACTER_ENCODING); message = MarkdownUtils.transformMarkdown(reader); reader.close(); + } catch (ResourceStreamNotFoundException t) { + if (lc == null) { + // could not find default language resource + message = MessageFormat.format(getString("gb.failedToReadMessage"), file); + error(message, t, false); + } else { + // ignore so we can try default language resource + message = null; + } } catch (Throwable t) { message = MessageFormat.format(getString("gb.failedToReadMessage"), file); error(message, t, false); diff --git a/src/com/gitblit/wicket/pages/RootPage.java b/src/com/gitblit/wicket/pages/RootPage.java index deb2f4b4..636ed00e 100644 --- a/src/com/gitblit/wicket/pages/RootPage.java +++ b/src/com/gitblit/wicket/pages/RootPage.java @@ -297,8 +297,9 @@ public abstract class RootPage extends BasePage { Set choicesSet = new HashSet(Arrays.asList(daysBack, 14, 28, 60, 90, 180)); List choices = new ArrayList(choicesSet); Collections.sort(choices); + String lastDaysPattern = getString("gb.lastNDays"); for (Integer db : choices) { - String txt = "last " + db + (db.intValue() > 1 ? " days" : "day"); + String txt = MessageFormat.format(lastDaysPattern, db); items.add(new DropDownMenuItem(txt, "db", db.toString(), params)); } items.add(new DropDownMenuItem()); diff --git a/src/com/gitblit/wicket/panels/RepositoriesPanel.java b/src/com/gitblit/wicket/panels/RepositoriesPanel.java index ee6e1191..3b429720 100644 --- a/src/com/gitblit/wicket/panels/RepositoriesPanel.java +++ b/src/com/gitblit/wicket/panels/RepositoriesPanel.java @@ -185,7 +185,7 @@ public class RepositoriesPanel extends BasePanel { row.add(new Label("repositorySize", entry.size).setVisible(showSize)); } else { // New repository - row.add(new Label("repositorySize", "(empty)") + row.add(new Label("repositorySize", "(" + getString("gb.empty") + ")") .setEscapeModelStrings(false)); } @@ -262,20 +262,19 @@ public class RepositoriesPanel extends BasePanel { @Override public void onClick() { if (GitBlit.self().deleteRepositoryModel(entry)) { - info(MessageFormat.format("Repository ''{0}'' deleted.", entry)); + info(MessageFormat.format(getString("gb.repositoryDeleted"), entry)); if (dp instanceof SortableRepositoriesProvider) { ((SortableRepositoriesProvider) dp).remove(entry); } else { ((RepositoriesProvider) dp).remove(entry); } } else { - error(MessageFormat.format("Failed to delete repository ''{0}''!", - entry)); + error(MessageFormat.format(getString("gb.repositoryDeleteFailed"), entry)); } } }; deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format( - "Delete repository \"{0}\"?", entry))); + getString("gb.deleteRepository"), entry))); repositoryLinks.add(deleteLink); row.add(repositoryLinks); } else if (showOwner) { diff --git a/src/com/gitblit/wicket/panels/UsersPanel.java b/src/com/gitblit/wicket/panels/UsersPanel.java index ecf4537d..39a5963a 100644 --- a/src/com/gitblit/wicket/panels/UsersPanel.java +++ b/src/com/gitblit/wicket/panels/UsersPanel.java @@ -87,15 +87,15 @@ public class UsersPanel extends BasePanel { public void onClick() { if (GitBlit.self().deleteUser(entry.username)) { users.remove(entry); - info(MessageFormat.format("User ''{0}'' deleted.", entry.username)); + info(MessageFormat.format(getString("gb.userDeleted"), entry.username)); } else { - error(MessageFormat.format("Failed to delete user ''{0}''!", + error(MessageFormat.format(getString("gb.deleteUserFailed"), entry.username)); } } }; deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format( - "Delete user \"{0}\"?", entry.username))); + getString("gb.deleteUser"), entry.username))); userLinks.add(deleteLink); item.add(userLinks); -- 2.39.5
CommitLineContent[commit][line][content]