Skip to content

The Unified and Autonomous Development Platform

wip: i18n support

Robin Shenc774a3fa9273
diff --git a/server-core/src/main/java/io/onedev/server/web/behavior/PatternSetAssistBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/PatternSetAssistBehavior.java
index 8c712882bd..5e7e9b9a97 100644
--- a/server-core/src/main/java/io/onedev/server/web/behavior/PatternSetAssistBehavior.java
+++ b/server-core/src/main/java/io/onedev/server/web/behavior/PatternSetAssistBehavior.java
@@ -1,5 +1,7 @@
package io.onedev.server.web.behavior;
+import static io.onedev.server.web.translation.Translation._T;
+
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -93,10 +95,10 @@ public abstract class PatternSetAssistBehavior extends ANTLRAssistBehavior {
String description;
switch (suggestedLiteral) {
case "-":
- description = "exclude";
+ description = _T("exclude");
break;
case " ":
- description = "space";
+ description = _T("space");
break;
case "\"":
return null;
diff --git a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/BlobDiffPanel.html b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/BlobDiffPanel.html
index f53868b7c9..fb269e6e02 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/BlobDiffPanel.html
+++ b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/BlobDiffPanel.html
@@ -4,9 +4,9 @@
<div wicket:id="title" class="mr-3 text-break"></div>
<div class="ml-auto text-nowrap d-flex align-items-center">
<a wicket:id="toggleReviewed" class="btn btn-xs btn-icon btn-hover-light"><svg wicket:id="icon" class="icon"/></a>
- <a wicket:id="blameFile" title="Blame" class="btn btn-xs btn-icon btn-hover-light"><wicket:svg href="commit" class="icon"/></a>
- <a wicket:id="viewFile" title="View" class="btn btn-xs btn-icon btn-hover-light ml-1"><wicket:svg href="eye" class="icon"/></a>
- <a wicket:id="editFile" title="Edit" class="btn btn-xs btn-icon btn-hover-light ml-1"><wicket:svg href="edit" class="icon"/></a>
+ <a wicket:id="blameFile" class="btn btn-xs btn-icon btn-hover-light"><wicket:svg href="commit" class="icon"/></a>
+ <a wicket:id="viewFile" class="btn btn-xs btn-icon btn-hover-light ml-1"><wicket:svg href="eye" class="icon"/></a>
+ <a wicket:id="editFile" class="btn btn-xs btn-icon btn-hover-light ml-1"><wicket:svg href="edit" class="icon"/></a>
<span wicket:id="diffStat" class="ml-2 text-nowrap"></span>
</div>
</div>
diff --git a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/BlobDiffPanel.java b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/BlobDiffPanel.java
index 1a1a852627..11b6a9c8c2 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/BlobDiffPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/BlobDiffPanel.java
@@ -98,7 +98,7 @@ public class BlobDiffPanel extends Panel {
for (DiffRenderer renderer: OneDev.getExtensions(DiffRenderer.class)) {
if (blob.getLfsPointer() != null
&& !new LfsObject(change.getProject().getId(), blob.getLfsPointer().getObjectId()).exists()) {
- diffPanel = newMessageFragment("Storage file missing", true);
+ diffPanel = newMessageFragment(_T("Storage file missing"), true);
break;
}
MediaType mediaType = change.getProject().detectMediaType(blob.getIdent());
@@ -111,14 +111,14 @@ public class BlobDiffPanel extends Panel {
add(diffPanel);
} else if (blob.getText() != null) {
if (blob.getText().getLines().size() > DiffUtils.MAX_DIFF_SIZE) {
- add(newMessageFragment("Unable to diff as the file is too large.", true));
+ add(newMessageFragment(_T("Unable to diff as the file is too large."), true));
} else if (change.getAdditions()+change.getDeletions() > WebConstants.MAX_SINGLE_DIFF_LINES) {
- add(newMessageFragment("Diff is too large to be displayed.", true));
+ add(newMessageFragment(_T("Diff is too large to be displayed."), true));
} else if (change.getDiffBlocks().isEmpty()) {
if (change.getNewBlobIdent().path != null)
- add(newMessageFragment("Empty file added.", false));
+ add(newMessageFragment(_T("Empty file added."), false));
else
- add(newMessageFragment("Empty file removed.", false));
+ add(newMessageFragment(_T("Empty file removed."), false));
} else {
add(new BlobTextDiffPanel(BODY_ID, change, diffMode, blameModel) {
@@ -139,7 +139,7 @@ public class BlobDiffPanel extends Panel {
});
}
} else {
- add(newMessageFragment("Binary file.", false));
+ add(newMessageFragment(_T("Binary file."), false));
}
}
@@ -184,10 +184,10 @@ public class BlobDiffPanel extends Panel {
return reviewed? "tick-box" : "square";
}
}));
- toggleReviewedLink.add(AttributeAppender.append("title", new AbstractReadOnlyModel<String>() {
+ toggleReviewedLink.add(AttributeAppender.append("data-tippy-content", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
- return reviewed? "Set unreviewed": "Set reviewed";
+ return reviewed? _T("Set unreviewed"): _T("Set reviewed");
}
}));
toggleReviewedLink.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {
@@ -227,13 +227,14 @@ public class BlobDiffPanel extends Panel {
return ((BlobTextDiffPanel) getDiffBody()).isBlame()? "link-primary": "";
}
- })).setOutputMarkupId(true));
+ })).add(AttributeAppender.append("data-tippy-content", _T("Blame"))).setOutputMarkupId(true));
ProjectBlobPage.State viewState = new ProjectBlobPage.State(change.getBlobIdent());
viewState.requestId = PullRequest.idOf(getPullRequest());
PageParameters params = ProjectBlobPage.paramsOf(change.getProject(), viewState);
- add(new ViewStateAwarePageLink<Void>("viewFile", ProjectBlobPage.class, params));
+ add(new ViewStateAwarePageLink<Void>("viewFile", ProjectBlobPage.class, params)
+ .add(AttributeAppender.append("data-tippy-content", _T("View"))));
if (change.getType() != ChangeType.DELETE && change.getNewBlob().getLfsPointer() == null) {
if (getPullRequest() != null
@@ -257,7 +258,7 @@ public class BlobDiffPanel extends Panel {
}
};
- editLink.add(AttributeAppender.replace("title", _T("Edit on source branch")));
+ editLink.add(AttributeAppender.replace("data-tippy-content", _T("Edit on source branch")));
add(editLink);
} else if (SecurityUtils.canModifyFile(change.getProject(), change.getBlobIdent().revision, change.getPath())
&& change.getProject().getBranchRef(change.getBlobIdent().revision) != null) {
@@ -275,7 +276,7 @@ public class BlobDiffPanel extends Panel {
}
};
- editLink.add(AttributeAppender.replace("title", MessageFormat.format(_T("Edit on branch {0}"), change.getBlobIdent().revision)));
+ editLink.add(AttributeAppender.replace("data-tippy-content", MessageFormat.format(_T("Edit on branch {0}"), change.getBlobIdent().revision)));
add(editLink);
} else {
add(new WebMarkupContainer("editFile").setVisible(false));
@@ -293,7 +294,7 @@ public class BlobDiffPanel extends Panel {
LfsPointer newLfsPointer = change.getNewBlob().getLfsPointer();
if (oldLfsPointer != null && !new LfsObject(change.getProject().getId(), oldLfsPointer.getObjectId()).exists()
|| newLfsPointer != null && !new LfsObject(change.getProject().getId(), newLfsPointer.getObjectId()).exists()) {
- add(newMessageFragment("Storage file missing", true));
+ add(newMessageFragment(_T("Storage file missing"), true));
} else {
MediaType oldMediaType = change.getProject().detectMediaType(change.getOldBlobIdent());
MediaType newMediaType = change.getProject().detectMediaType(change.getNewBlobIdent());
@@ -312,14 +313,14 @@ public class BlobDiffPanel extends Panel {
add(diffPanel);
} else if (change.getOldText() != null && change.getNewText() != null) {
if (change.getOldText().getLines().size() + change.getNewText().getLines().size() > DiffUtils.MAX_DIFF_SIZE) {
- add(newMessageFragment("Unable to diff as the file is too large.", true));
+ add(newMessageFragment(_T("Unable to diff as the file is too large."), true));
} else if (change.getOldText().getLines().stream().anyMatch(it->it.length()>MAX_LINE_LEN)
|| change.getOldText().getLines().stream().anyMatch(it->it.length()>MAX_LINE_LEN)) {
- add(newMessageFragment("Unable to diff as some line is too long.", true));
+ add(newMessageFragment(_T("Unable to diff as some line is too long."), true));
} else if (change.getAdditions() + change.getDeletions() > WebConstants.MAX_SINGLE_DIFF_LINES) {
- add(newMessageFragment("Diff is too large to be displayed.", true));
+ add(newMessageFragment(_T("Diff is too large to be displayed."), true));
} else if (change.getAdditions() + change.getDeletions() == 0) {
- add(newMessageFragment("Content is identical", false));
+ add(newMessageFragment(_T("Content is identical"), false));
} else {
add(new BlobTextDiffPanel(BODY_ID, change, diffMode, blameModel) {
@@ -341,7 +342,7 @@ public class BlobDiffPanel extends Panel {
});
}
} else {
- add(newMessageFragment("Binary file.", false));
+ add(newMessageFragment(_T("Binary file."), false));
}
}
}
diff --git a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/BlobTextDiffPanel.java b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/BlobTextDiffPanel.java
index 391793ea40..8a23805519 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/BlobTextDiffPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/BlobTextDiffPanel.java
@@ -7,6 +7,7 @@ import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
import static org.unbescape.javascript.JavaScriptEscape.escapeJavaScript;
import java.io.Serializable;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -523,10 +524,14 @@ public class BlobTextDiffPanel extends Panel {
}
for (int j=0; j<nextBlock.getElements().size(); j++) {
List<DiffBlock<String>> lineDiff = lineDiffs.get(j);
- if (lineDiff != null)
- appendUnifiedInsert(builder, nextBlock, j, lineDiff);
- else
+ if (lineDiff != null) {
+ var oldLine = block.getElements().get(j);
+ var newLine = nextBlock.getElements().get(j);
+ var confusable = isConfusable(oldLine, newLine);
+ appendUnifiedInsert(builder, nextBlock, j, new Pair<>(lineDiff, confusable));
+ } else {
appendUnifiedInsert(builder, nextBlock, j, null);
+ }
}
} else {
int prevLineIndex = 0;
@@ -747,7 +752,7 @@ public class BlobTextDiffPanel extends Panel {
}
private void appendUnifiedInsert(StringBuilder builder, DiffBlock<String> block, int lineIndex,
- @Nullable List<DiffBlock<String>> tokenDiffs) {
+ @Nullable Pair<List<DiffBlock<String>>, Boolean> lineCompareInfo) {
builder.append("<tr class='code original'>");
int newLineNo = block.getNewStart() + lineIndex;
@@ -756,30 +761,16 @@ public class BlobTextDiffPanel extends Panel {
}
builder.append("<td class='number noselect new'><a class='coverage'>&nbsp;</a></td>");
builder.append("<td class='number noselect new'>");
- boolean confusable = false;
- var oldLineBuilder = new StringBuilder();
- var newLineBuilder = new StringBuilder();
- if (tokenDiffs != null && !tokenDiffs.isEmpty()) {
- for (DiffBlock<String> tokenBlock: tokenDiffs) {
- for (String token: tokenBlock.getElements()) {
- if (tokenBlock.getOperation() != Operation.DELETE || tokenBlock.getOperation() != Operation.EQUAL)
- oldLineBuilder.append(token);
- if (tokenBlock.getOperation() != Operation.INSERT || tokenBlock.getOperation() != Operation.EQUAL)
- newLineBuilder.append(token);
- }
- confusable = isConfusable(oldLineBuilder.toString(), newLineBuilder.toString());
- }
- }
- if (confusable)
+ if (lineCompareInfo != null && lineCompareInfo.getRight())
builder.append(getConfusableMark());
builder.append(newLineNo+1).append("<a class='coverage'>&nbsp;</a></td>");
builder.append("<td class='operation noselect new'>+</td>");
builder.append("<td class='content new' data-new='").append(newLineNo).append("'>");
- if (tokenDiffs != null) {
- if (tokenDiffs.isEmpty()) {
+ if (lineCompareInfo != null) {
+ if (lineCompareInfo.getLeft().isEmpty()) {
builder.append("&nbsp;");
} else {
- for (DiffBlock<String> tokenBlock: tokenDiffs) {
+ for (DiffBlock<String> tokenBlock: lineCompareInfo.getLeft()) {
for (String token: tokenBlock.getElements()) {
if (tokenBlock.getOperation() != Operation.DELETE)
builder.append(toHtml(token, getOperationClass(tokenBlock.getOperation())));
@@ -926,33 +917,34 @@ public class BlobTextDiffPanel extends Panel {
SpriteImage.getVersionedHref(IconScope.class, "ellipsis"));
String script = String.format("javascript:$('#%s').data('callback')('expand', %d);", getMarkupId(), blockIndex);
+ var skippedMessage = MessageFormat.format(_T("skipped {0} lines"), skippedLines);
if (diffMode == DiffViewMode.UNIFIED) {
if (blameInfo != null) {
- builder.append("<td colspan='3' class='expander noselect'><a title='Show more lines' href=\"")
+ builder.append("<td colspan='3' class='expander noselect'><a data-tippy-content='" + _T("Show more lines") + "' href=\"")
.append(script).append("\">").append(expandSvg).append("</a></td>");
blameInfo.lastCommitHash = null;
blameInfo.lastOldCommitHash = null;
blameInfo.lastNewCommitHash = null;
} else {
- builder.append("<td colspan='2' class='expander noselect'><a title='Show more lines' href=\"")
+ builder.append("<td colspan='2' class='expander noselect'><a data-tippy-content='" + _T("Show more lines") + "' href=\"")
.append(script).append("\">").append(expandSvg).append("</a></td>");
}
- builder.append("<td colspan='2' class='skipped noselect'>").append(ellipsisSvg).append(" skipped ")
- .append(skippedLines).append(" lines ").append(ellipsisSvg).append("</td>");
+ builder.append("<td colspan='2' class='skipped noselect'>").append(ellipsisSvg).append(" ")
+ .append(skippedMessage).append(" ").append(ellipsisSvg).append("</td>");
} else {
if (blameInfo != null) {
- builder.append("<td colspan='2' class='expander noselect'><a title='Show more lines' href=\"").append(script)
+ builder.append("<td colspan='2' class='expander noselect'><a data-tippy-content='" + _T("Show more lines") + "' href=\"").append(script)
.append("\">").append(expandSvg).append("</a></td>");
- builder.append("<td class='skipped noselect' colspan='6'>").append(ellipsisSvg).append(" skipped ")
- .append(skippedLines).append(" lines ").append(ellipsisSvg).append("</td>");
+ builder.append("<td class='skipped noselect' colspan='6'>").append(ellipsisSvg).append(" ")
+ .append(skippedMessage).append(" ").append(ellipsisSvg).append("</td>");
blameInfo.lastCommitHash = null;
blameInfo.lastOldCommitHash = null;
blameInfo.lastNewCommitHash = null;
} else {
- builder.append("<td class='expander noselect'><a title='Show more lines' href=\"").append(script)
+ builder.append("<td class='expander noselect'><a data-tippy-content='" + _T("Show more lines") + "' href=\"").append(script)
.append("\">").append(expandSvg).append("</a></td>");
- builder.append("<td class='skipped noselect' colspan='5'>").append(ellipsisSvg).append(" skipped ")
- .append(skippedLines).append(" lines ").append(ellipsisSvg).append("</td>");
+ builder.append("<td class='skipped noselect' colspan='5'>").append(ellipsisSvg).append(" ")
+ .append(skippedMessage).append(" ").append(ellipsisSvg).append("</td>");
}
}
builder.append("</tr>");
diff --git a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/blob-text-diff.js b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/blob-text-diff.js
index d4a60b14aa..be5a9790a2 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/blob-text-diff.js
+++ b/server-core/src/main/java/io/onedev/server/web/component/diff/blob/text/blob-text-diff.js
@@ -866,6 +866,12 @@ onedev.server.blobTextDiff = {
onedev.server.blobTextDiff.initBlameTooltip(containerId, $expandedTrs.find(">td.blame>a.hash"));
onedev.server.blobTextDiff.highlightSyntax($container);
+ $container.find("td.expander a").each(function() {
+ tippy(this, {
+ delay: [500, 0],
+ placement: 'auto'
+ });
+ });
},
getMarkInfo: function($container, markRange) {
var oldOrNew = markRange.leftSide?"old":"new";
diff --git a/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.html b/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.html
index a3fbcf15f2..0606ffb401 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.html
+++ b/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.html
@@ -46,7 +46,7 @@
<div class="ui-resizable-handle ui-resizable-e flex-shrink-0"></div>
</div>
<ul class="diffs list-unstyled flex-grow-1 mb-0"><li wicket:id="diffs" class="diff mb-4"><div wicket:id="diff"></div></li></ul>
- <div wicket:id="noDiffs" class="alert alert-notice alert-light-warning flex-grow-1 mb-0">No diffs</div>
+ <div wicket:id="noDiffs" class="alert alert-notice alert-light-warning flex-grow-1 mb-0"><wicket:t>No diffs</wicket:t></div>
<div wicket:id="navigation" class="navigation need-width border border-left-0 rounded d-flex overflow-hidden flex-shrink-0 position-sticky ml-3">
<div class="ui-resizable-handle ui-resizable-w flex-shrink-0"></div>
<div wicket:id="content" class="content flex-grow-1 overflow-auto p-3"></div>
diff --git a/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.java b/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.java
index e961a56c58..6391505cb3 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/diff/revision/RevisionDiffPanel.java
@@ -106,6 +106,7 @@ import javax.annotation.Nullable;
import javax.servlet.http.Cookie;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
+import java.text.MessageFormat;
import java.util.*;
import static io.onedev.server.web.translation.Translation._T;
@@ -434,7 +435,7 @@ public abstract class RevisionDiffPanel extends Panel {
@Override
public String getLabel() {
- return "Commit";
+ return _T("Commit");
}
@Override
@@ -492,7 +493,7 @@ public abstract class RevisionDiffPanel extends Panel {
@Override
public String getLabel() {
- return "Discard";
+ return _T("Discard");
}
@Override
@@ -503,7 +504,7 @@ public abstract class RevisionDiffPanel extends Panel {
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.getAjaxCallListeners().add(new ConfirmClickListener(
- "Do you really want to discard batched suggestions?"));
+ _T("Do you really want to discard batched suggestions?")));
}
@Override
@@ -632,8 +633,8 @@ public abstract class RevisionDiffPanel extends Panel {
@Override
protected List<String> getHints(TerminalExpect terminalExpect) {
return Lists.newArrayList(
- "Path containing spaces or starting with dash needs to be quoted",
- "Use '**', '*' or '?' for <a href='https://docs.onedev.io/appendix/path-wildcard' target='_blank'>path wildcard match</a>. Prefix with '-' to exclude"
+ _T("Path containing spaces or starting with dash needs to be quoted"),
+ _T("Use '**', '*' or '?' for <a href='https://docs.onedev.io/appendix/path-wildcard' target='_blank'>path wildcard match</a>. Prefix with '-' to exclude")
);
}
@@ -694,7 +695,7 @@ public abstract class RevisionDiffPanel extends Panel {
@Override
protected String load() {
var reviewSupport = getReviewSupport();
- return getDisplayChanges().stream().filter(it->reviewSupport.isReviewed(it.getPath())).count() + "/" + getDisplayChanges().size() + " reviewed";
+ return MessageFormat.format(_T("{0} reviewed"), getDisplayChanges().stream().filter(it->reviewSupport.isReviewed(it.getPath())).count() + "/" + getDisplayChanges().size());
}
}));
reviewProgress.setOutputMarkupPlaceholderTag(true);
@@ -733,7 +734,7 @@ public abstract class RevisionDiffPanel extends Panel {
@Override
public String getObject() {
- return "Showing first " + getDisplayChanges().size() + " files as there are too many";
+ return MessageFormat.format(_T("Showing first {0} files as there are too many"), getDisplayChanges().size());
}
}) {
@@ -915,7 +916,7 @@ public abstract class RevisionDiffPanel extends Panel {
String content = contentInput.getModelObject();
if (content.length() > CodeComment.MAX_CONTENT_LEN) {
- error("Comment too long");
+ error(_T("Comment too long"));
target.add(feedback);
} else {
CodeComment comment = new CodeComment();
@@ -1484,7 +1485,7 @@ public abstract class RevisionDiffPanel extends Panel {
}
});
} else {
- navigationContainer.add(new Label("content", "<i>No diffs to navigate</i>").setEscapeModelStrings(false));
+ navigationContainer.add(new Label("content", "<i>" + _T("No diffs to navigate") + "</i>").setEscapeModelStrings(false));
}
navigationContainer.setOutputMarkupPlaceholderTag(true);
@@ -1578,14 +1579,14 @@ public abstract class RevisionDiffPanel extends Panel {
protected void onInitialize() {
super.onInitialize();
- add(AttributeAppender.replace("title", new AbstractReadOnlyModel<String>() {
+ add(AttributeAppender.replace("data-tippy-content", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (annotationSupport.getOpenComment().isResolved())
- return "Resolved";
+ return _T("Resolved");
else
- return "Unresolved";
+ return _T("Unresolved");
}
}));
@@ -2128,7 +2129,7 @@ public abstract class RevisionDiffPanel extends Panel {
String content = contentInput.getModelObject();
if (content.length() > CodeComment.MAX_CONTENT_LEN) {
- error("Comment too long");
+ error(_T("Comment too long"));
target.add(feedback);
} else {
CodeComment comment = new CodeComment();
diff --git a/server-core/src/main/java/io/onedev/server/web/component/diff/revision/SuggestionBatchApplyBean.java b/server-core/src/main/java/io/onedev/server/web/component/diff/revision/SuggestionBatchApplyBean.java
index 491be17e64..f84abb549d 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/diff/revision/SuggestionBatchApplyBean.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/diff/revision/SuggestionBatchApplyBean.java
@@ -1,5 +1,7 @@
package io.onedev.server.web.component.diff.revision;
+import static io.onedev.server.web.translation.Translation._T;
+
import java.io.Serializable;
import javax.validation.constraints.NotEmpty;
@@ -13,7 +15,7 @@ public class SuggestionBatchApplyBean implements Serializable {
private static final long serialVersionUID = 1L;
- private String commitMessage = "Apply suggested changes from code comments";
+ private String commitMessage = _T("Apply suggested changes from code comments");
@Editable
@OmitName
diff --git a/server-core/src/main/java/io/onedev/server/web/component/issue/primary/IssuePrimaryPanel.java b/server-core/src/main/java/io/onedev/server/web/component/issue/primary/IssuePrimaryPanel.java
index a7fe5b89b1..e05c70cf8e 100644
--- a/server-core/src/main/java/io/onedev/server/web/component/issue/primary/IssuePrimaryPanel.java
+++ b/server-core/src/main/java/io/onedev/server/web/component/issue/primary/IssuePrimaryPanel.java
@@ -200,7 +200,7 @@ public abstract class IssuePrimaryPanel extends Panel {
@Override
protected String getEmptyDescription() {
- return "No description";
+ return _T("No description");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/page/admin/issuesetting/statespec/IssueStateListPage.java b/server-core/src/main/java/io/onedev/server/web/page/admin/issuesetting/statespec/IssueStateListPage.java
index b88e1b0c70..057506206f 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/admin/issuesetting/statespec/IssueStateListPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/admin/issuesetting/statespec/IssueStateListPage.java
@@ -34,6 +34,8 @@ import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.unbescape.html.HtmlEscape;
+import static io.onedev.server.web.translation.Translation._T;
+
import java.util.ArrayList;
import java.util.List;
@@ -133,7 +135,7 @@ public class IssueStateListPage extends IssueSettingPage {
if (description != null)
cellItem.add(new Label(componentId, description));
else
- cellItem.add(new Label(componentId, "<i>No description</i>").setEscapeModelStrings(false));
+ cellItem.add(new Label(componentId, "<i>" + _T("No description") + "</i>").setEscapeModelStrings(false));
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.java b/server-core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.java
index 317a50b3b9..6dbd547e59 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.java
@@ -1,6 +1,7 @@
package io.onedev.server.web.page.project.compare;
import static io.onedev.server.search.commit.Revision.Type.COMMIT;
+import static io.onedev.server.web.translation.Translation._T;
import java.io.Serializable;
import java.util.ArrayList;
@@ -506,7 +507,7 @@ public class RevisionComparePage extends ProjectPage implements RevisionAnnotati
if (mergeBase != null) {
List<Tab> tabs = new ArrayList<>();
- tabs.add(new AjaxActionTab(Model.of("Commits")) {
+ tabs.add(new AjaxActionTab(Model.of(_T("Commits"))) {
@Override
public boolean isSelected() {
@@ -523,7 +524,7 @@ public class RevisionComparePage extends ProjectPage implements RevisionAnnotati
});
- tabs.add(new AjaxActionTab(Model.of("File Changes")) {
+ tabs.add(new AjaxActionTab(Model.of(_T("File Changes"))) {
@Override
public boolean isSelected() {
diff --git a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java
index 602ab48205..e2b2e707ee 100644
--- a/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java
+++ b/server-core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/PullRequestDetailPage.java
@@ -1668,7 +1668,7 @@ public abstract class PullRequestDetailPage extends ProjectPage implements PullR
@Override
protected String getEmptyDescription() {
- return "No description";
+ return _T("No description");
}
@Override
diff --git a/server-core/src/main/java/io/onedev/server/web/translation/Translation_zh_CN.java b/server-core/src/main/java/io/onedev/server/web/translation/Translation_zh_CN.java
index 9b8ef50671..b79e8d11d0 100644
--- a/server-core/src/main/java/io/onedev/server/web/translation/Translation_zh_CN.java
+++ b/server-core/src/main/java/io/onedev/server/web/translation/Translation_zh_CN.java
@@ -140,6 +140,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Applicable Users", "适用用户");
m.put("Application (client) ID", "应用(客户端)ID");
m.put("Apply suggested change from code comment", "从代码评论应用建议的更改");
+ m.put("Apply suggested changes from code comments", "从代码评论应用建议的更改");
m.put("Approved", "已批准");
m.put("Arbitrary scope", "任意范围");
m.put("Arbitrary type", "任意类型");
@@ -186,6 +187,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Below are some common criterias. Type in search box above to view the complete list and available combinations.",
"以下是一些常见的条件。在搜索框中输入以查看完整列表和可用组合。");
m.put("Below content is restored from an unsaved change. Clear to discard", "以下内容从未保存的更改中恢复。清除以丢弃");
+ m.put("Binary file.", "二进制文件");
m.put("Bitbucket App Password", "Bitbucket应用密码");
m.put("Bitbucket Login Name", "Bitbucket登录名");
m.put("Bitbucket Repositories to Import", "要导入的Bitbucket仓库");
@@ -410,6 +412,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Connector", "连接器");
m.put("Container default", "容器默认");
m.put("Content", "内容");
+ m.put("Content is identical", "内容相同");
m.put("Contributed settings", "贡献的设置");
m.put("Copy", "复制");
m.put("Copy Files with SCP", "使用 SCP 复制文件");
@@ -507,6 +510,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Detect Licenses", "检测许可证");
m.put("Detect Secrets", "检测敏感信息");
m.put("Detect Vulnerabilities", "检测漏洞");
+ m.put("Diff is too large to be displayed.", "差异太大,无法显示");
m.put("Diff options", "差异选项");
m.put("Digest invalid", "摘要无效");
m.put("Directories to Skip", "要跳过的目录");
@@ -514,6 +518,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Directory (tenant) ID", "目录(租户)ID");
m.put("Disable Auto Update Check", "禁用自动更新检查");
m.put("Disable Dashboard", "禁用仪表盘");
+ m.put("Discard", "丢弃");
m.put("Discarded", "已丢弃");
m.put("Discord", "Discord");
m.put("Discord Notifications", "Discord 通知");
@@ -529,6 +534,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Do you really want to delete this code comment?", "您真的要删除此代码评论吗?");
m.put("Do you really want to delete this email address?", "您真的要删除这个电子邮件地址吗?");
m.put("Do you really want to delete this reply?", "您真的要删除此回复吗?");
+ m.put("Do you really want to discard batched suggestions?", "您真的要丢弃批量建议吗?");
m.put("Do you really want to remove this link?", "您确定要删除此链接吗?");
m.put("Docker Executable", "Docker 可执行文件");
m.put("Docker Image", "Docker 镜像");
@@ -563,6 +569,8 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Email Verification", "邮件验证");
m.put("Email address", "电子邮件地址");
m.put("Email templates", "邮箱模板");
+ m.put("Empty file added.", "空文件已添加");
+ m.put("Empty file removed.", "空文件已删除");
m.put("Enable", "启用");
m.put("Enable <a href='https://docs.onedev.io/tutorials/issue/time-tracking' target='_blank'>time tracking</a> for this project to track progress and generate timesheets",
"为此项目启用<a href='https://docs.onedev.io/tutorials/issue/time-tracking' target='_blank'>时间跟踪</a>以跟踪进度并生成时间表");
@@ -647,6 +655,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Fields", "字段");
m.put("Fields And Links Bean", "字段和链接 Bean");
m.put("File", "文件");
+ m.put("File Changes", "文件变更");
m.put("File Path", "文件路径");
m.put("File Patterns", "文件模式");
m.put("File Protection", "文件保护");
@@ -875,6 +884,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Invalid PCRE syntax", "无效的 PCRE 语法");
m.put("Invalid credentials", "无效的凭据");
m.put("Invalid request path", "无效的请求路径");
+ m.put("Invalid selection, click for details", "无效的选择,点击查看详情");
m.put("Invitations", "邀请");
m.put("Is Site Admin", "是否为站点管理员");
m.put("Issue", "工单");
@@ -1151,6 +1161,8 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("No default role", "无默认角色");
m.put("No default value", "无默认值");
m.put("No description", "无描述");
+ m.put("No diffs", "没有差异");
+ m.put("No diffs to navigate", "没有差异可导航");
m.put("No directories to skip", "无要跳过的目录");
m.put("No external authenticator", "无外部认证器");
m.put("No fields to prompt", "无要提示的字段");
@@ -1519,6 +1531,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Password and its confirmation should be identical.", "密码和其确认应相同。");
m.put("Password or Access Token for Remote Repository", "密码或远程仓库的访问令牌");
m.put("Paste subscription key here", "在此粘贴订阅密钥");
+ m.put("Path containing spaces or starting with dash needs to be quoted", "路径包含空格或以破折号开头时需要用引号括起来");
m.put("Path placeholder", "路径占位符");
m.put("Path to kubectl", "kubectl 的路径");
m.put("Paths", "路径");
@@ -1839,6 +1852,8 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Set Up Cache", "设置缓存");
m.put("Set Up Renovate Cache", "设置 Renovate 缓存");
m.put("Set Up Trivy Cache", "设置 Trivy 缓存");
+ m.put("Set reviewed", "设置为已审阅");
+ m.put("Set unreviewed", "设置为未审阅");
m.put("Set up discord notification settings. Settings will be inherited by child projects, and can be overridden by defining settings with same webhook url",
"设置 Discord 通知设置。设置将继承给子项目,并可以通过定义具有相同 Webhook URL 的设置来覆盖");
m.put("Set up job cache to speed up job execution. Check <a href='https://docs.onedev.io/tutorials/cicd/job-cache' target='_blank'>this tutorial</a> on how to use job cache",
@@ -1870,6 +1885,8 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Show Works Of", "显示工作量");
m.put("Show commented code snippet", "显示注释的代码片段");
m.put("Show emojis", "显示表情符号");
+ m.put("Show more lines", "显示更多行");
+ m.put("Showing first {0} files as there are too many", "显示前 {0} 个文件,因为文件太多");
m.put("Sign In", "登录");
m.put("Sign In To", "登录到");
m.put("Sign Out", "登出");
@@ -2255,6 +2272,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
"步骤将在同一节点上按顺序执行,共享同一 <a href='https://docs.onedev.io/concepts#job-workspace'>任务工作空间</a>");
m.put("Stopwatch Overdue", "秒表逾期");
m.put("Storage Setting", "存储设置");
+ m.put("Storage file missing", "存储文件缺失");
m.put("Storage not found", "未找到存储");
m.put("Stored with Git LFS", "使用 Git LFS 存储");
m.put("Subject", "主题");
@@ -2415,8 +2433,11 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Type password here", "在此输入密码");
m.put("Type to filter", "过滤");
m.put("URL", "URL");
+ m.put("Unable to comment", "无法添加评论");
m.put("Unable to connect to server", "无法连接到服务器");
m.put("Unable to create protected tag", "无法创建受保护的标签");
+ m.put("Unable to diff as some line is too long.", "无法比较,因为某些行太长");
+ m.put("Unable to diff as the file is too large.", "无法比较,因为文件太大");
m.put("Unable to send verification email as mail service is not configured yet", "无法发送验证电子邮件,因为邮件服务未配置");
m.put("Unauthorized", "未授权");
m.put("Undefined Field Resolution", "未定义字段解析");
@@ -2448,6 +2469,8 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Upload to Project", "上传到项目");
m.put("Uploading file", "上传文件");
m.put("Url", "URL");
+ m.put("Use '**', '*' or '?' for <a href='https://docs.onedev.io/appendix/path-wildcard' target='_blank'>path wildcard match</a>. Prefix with '-' to exclude",
+ "使用 '**', '*' 或 '?' 进行 <a href='https://docs.onedev.io/appendix/path-wildcard' target='_blank'>路径通配符匹配</a>。前缀为 '-' 以排除");
m.put("Use Avatar Service", "使用头像服务");
m.put("Use For Git Operations", "用于 Git 操作");
m.put("Use Git in System Path", "使用系统路径中的 Git");
@@ -2494,7 +2517,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("Verification Code", "验证码");
m.put("Verification email sent, please check it", "验证电子邮件已发送,请检查");
m.put("Verify", "验证");
- m.put("View", "视图");
+ m.put("View", "查看");
m.put("View Source", "查看源码");
m.put("Viewer", "查看者");
m.put("Volume Mount", "卷挂载");
@@ -2599,6 +2622,7 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("curl Path", "curl 路径");
m.put("descending", "降序");
m.put("does not have any value of", "没有任何值");
+ m.put("exclude", "排除");
m.put("false", "假");
m.put("found 1 comment", "找到 1 条评论");
m.put("found 1 project", "找到 1 个项目");
@@ -2618,6 +2642,8 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("pull requests", "合并请求");
m.put("root", "根");
m.put("search in this revision will be accurate after indexed", "索引完成后,在当前版本中的搜索将更准确");
+ m.put("skipped {0} lines", "跳过 {0} 行");
+ m.put("space", "空格");
m.put("submit", "提交");
m.put("tags", "标签");
m.put("true", "真");
@@ -2626,9 +2652,8 @@ public class Translation_zh_CN extends TranslationResourceBundle {
m.put("{0} edited {1}", "{0} 编辑于 {1}");
m.put("{0} files", "{0} 个文件");
m.put("{0} tags", "{0} 个标签");
- m.put("Unable to comment here", "无法在此添加评论");
- m.put("Invalid selection, click for details", "无效的选择,点击查看详情");
-
+ m.put("{0} reviewed", "{0} 已审查");
+
// Manually added keys
m.put("Create Administrator Account", "创建管理员账户");
m.put("Server Setup", "服务器设置");