View Javadoc
1   /*
2    * Copyright (C) 2010, 2013 Sasa Zivkov <sasa.zivkov@sap.com>
3    * Copyright (C) 2013, Obeo
4    * and other copyright owners as documented in the project's IP log.
5    *
6    * This program and the accompanying materials are made available
7    * under the terms of the Eclipse Distribution License v1.0 which
8    * accompanies this distribution, is reproduced below, and is
9    * available at http://www.eclipse.org/org/documents/edl-v10.php
10   *
11   * All rights reserved.
12   *
13   * Redistribution and use in source and binary forms, with or
14   * without modification, are permitted provided that the following
15   * conditions are met:
16   *
17   * - Redistributions of source code must retain the above copyright
18   *   notice, this list of conditions and the following disclaimer.
19   *
20   * - Redistributions in binary form must reproduce the above
21   *   copyright notice, this list of conditions and the following
22   *   disclaimer in the documentation and/or other materials provided
23   *   with the distribution.
24   *
25   * - Neither the name of the Eclipse Foundation, Inc. nor the
26   *   names of its contributors may be used to endorse or promote
27   *   products derived from this software without specific prior
28   *   written permission.
29   *
30   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
31   * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
32   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
33   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
35   * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
37   * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
39   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
42   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43   */
44  
45  package org.eclipse.jgit.pgm.internal;
46  
47  import java.text.MessageFormat;
48  import java.util.Locale;
49  
50  import org.eclipse.jgit.nls.NLS;
51  import org.eclipse.jgit.nls.TranslationBundle;
52  import org.kohsuke.args4j.Localizable;
53  
54  /**
55   * Translation bundle for JGit command line interface
56   */
57  public class CLIText extends TranslationBundle {
58  	/**
59  	 * Formats text strings using {@code Localizable}.
60  	 *
61  	 */
62  	public static class Format implements Localizable {
63  		final String text;
64  
65  		Format(String text) {
66  			this.text = text;
67  		}
68  
69  		@Override
70  		public String formatWithLocale(Locale locale, Object... args) {
71  			// we don't care about Locale for now
72  			return format(args);
73  		}
74  
75  		@Override
76  		public String format(Object... args) {
77  			return MessageFormat.format(text, args);
78  		}
79  	}
80  
81  	/**
82  	 * Format text
83  	 *
84  	 * @param text
85  	 *            the text to format.
86  	 * @return a new Format instance.
87  	 */
88  	public static Format format(String text) {
89  		return new Format(text);
90  	}
91  
92  	/**
93  	 * Get an instance of this translation bundle
94  	 *
95  	 * @return an instance of this translation bundle
96  	 */
97  	public static CLIText get() {
98  		return NLS.getBundleFor(CLIText.class);
99  	}
100 
101 	/**
102 	 * Format the given line for using the format defined by {@link #lineFormat}
103 	 * ("# " by default).
104 	 *
105 	 * @param line
106 	 *            the line to format
107 	 * @return the formatted line
108 	 */
109 	public static String formatLine(String line) {
110 		return MessageFormat.format(get().lineFormat, line);
111 	}
112 
113 	/**
114 	 * Format the given argument as fatal error using the format defined by
115 	 * {@link #fatalError} ("fatal: " by default).
116 	 *
117 	 * @param message
118 	 *            the message to format
119 	 * @return the formatted line
120 	 */
121 	public static String fatalError(String message) {
122 		return MessageFormat.format(get().fatalError, message);
123 	}
124 
125 	// @formatter:off
126 	/***/ public String alreadyOnBranch;
127 	/***/ public String alreadyUpToDate;
128 	/***/ public String answerNo;
129 	/***/ public String answerYes;
130 	/***/ public String authorInfo;
131 	/***/ public String averageMSPerRead;
132 	/***/ public String branchAlreadyExists;
133 	/***/ public String branchCreatedFrom;
134 	/***/ public String branchDetachedHEAD;
135 	/***/ public String branchIsNotAnAncestorOfYourCurrentHEAD;
136 	/***/ public String branchNameRequired;
137 	/***/ public String branchNotFound;
138 	/***/ public String cacheTreePathInfo;
139 	/***/ public String configFileNotFound;
140 	/***/ public String cannotBeRenamed;
141 	/***/ public String cannotChekoutNoHeadsAdvertisedByRemote;
142 	/***/ public String cannotCombineSquashWithNoff;
143 	/***/ public String cannotCreateCommand;
144 	/***/ public String cannotCreateOutputStream;
145 	/***/ public String cannotDeatchHEAD;
146 	/***/ public String cannotDeleteFile;
147 	/***/ public String cannotDeleteTheBranchWhichYouAreCurrentlyOn;
148 	/***/ public String cannotGuessLocalNameFrom;
149 	/***/ public String cannotLock;
150 	/***/ public String cannotMergeDetachedHead;
151 	/***/ public String cannotReadBecause;
152 	/***/ public String cannotReadPackageInformation;
153 	/***/ public String cannotRenameDetachedHEAD;
154 	/***/ public String cannotResolve;
155 	/***/ public String cannotSetupConsole;
156 	/***/ public String cannotUseObjectsWithGlog;
157 	/***/ public String cantFindGitDirectory;
158 	/***/ public String cantWrite;
159 	/***/ public String changesNotStagedForCommit;
160 	/***/ public String changesToBeCommitted;
161 	/***/ public String checkingOut;
162 	/***/ public String checkoutConflict;
163 	/***/ public String checkoutConflictPathLine;
164 	/***/ public String cleanRequireForce;
165 	/***/ public String clonedEmptyRepository;
166 	/***/ public String cloningInto;
167 	/***/ public String commitLabel;
168 	/***/ public String conflictingUsageOf_git_dir_andArguments;
169 	/***/ public String couldNotCreateBranch;
170 	/***/ public String dateInfo;
171 	/***/ public String deletedBranch;
172 	/***/ public String deletedRemoteBranch;
173 	/***/ public String doesNotExist;
174 	/***/ public String dontOverwriteLocalChanges;
175 	/***/ public String everythingUpToDate;
176 	/***/ public String expectedNumberOfbytes;
177 	/***/ public String exporting;
178 	/***/ public String failedToCommitIndex;
179 	/***/ public String failedToLockIndex;
180 	/***/ public String failedToLockTag;
181 	/***/ public String fatalError;
182 	/***/ public String fatalThisProgramWillDestroyTheRepository;
183 	/***/ public String fetchingSubmodule;
184 	/***/ public String fileIsRequired;
185 	/***/ public String ffNotPossibleAborting;
186 	/***/ public String forcedUpdate;
187 	/***/ public String fromURI;
188 	/***/ public String initializedEmptyGitRepositoryIn;
189 	/***/ public String invalidHttpProxyOnlyHttpSupported;
190 	/***/ public String invalidRecurseSubmodulesMode;
191 	/***/ public String invalidUntrackedFilesMode;
192 	/***/ public String jgitVersion;
193 	/***/ public String lfsNoAccessKey;
194 	/***/ public String lfsNoSecretKey;
195 	/***/ public String lfsProtocolUrl;
196 	/***/ public String lfsStoreDirectory;
197 	/***/ public String lfsStoreUrl;
198 	/***/ public String lfsUnknownStoreType;
199 	/***/ public String lineFormat;
200 	/***/ public String listeningOn;
201 	/***/ public String mergeCheckoutConflict;
202 	/***/ public String mergeConflict;
203 	/***/ public String mergeFailed;
204 	/***/ public String mergeCheckoutFailed;
205 	/***/ public String mergeMadeBy;
206 	/***/ public String mergedSquashed;
207 	/***/ public String mergeWentWellStoppedBeforeCommitting;
208 	/***/ public String metaVar_KEY;
209 	/***/ public String metaVar_archiveFormat;
210 	/***/ public String metaVar_archivePrefix;
211 	/***/ public String metaVar_arg;
212 	/***/ public String metaVar_author;
213 	/***/ public String metaVar_bucket;
214 	/***/ public String metaVar_command;
215 	/***/ public String metaVar_commandDetail;
216 	/***/ public String metaVar_commitOrTag;
217 	/***/ public String metaVar_commitPaths;
218 	/***/ public String metaVar_commitish;
219 	/***/ public String metaVar_configFile;
220 	/***/ public String metaVar_connProp;
221 	/***/ public String metaVar_diffAlg;
222 	/***/ public String metaVar_directory;
223 	/***/ public String metaVar_file;
224 	/***/ public String metaVar_filepattern;
225 	/***/ public String metaVar_gitDir;
226 	/***/ public String metaVar_hostName;
227 	/***/ public String metaVar_lfsStorage;
228 	/***/ public String metaVar_linesOfContext;
229 	/***/ public String metaVar_message;
230 	/***/ public String metaVar_n;
231 	/***/ public String metaVar_name;
232 	/***/ public String metaVar_object;
233 	/***/ public String metaVar_op;
234 	/***/ public String metaVar_pass;
235 	/***/ public String metaVar_path;
236 	/***/ public String metaVar_paths;
237 	/***/ public String metaVar_pattern;
238 	/***/ public String metaVar_port;
239 	/***/ public String metaVar_ref;
240 	/***/ public String metaVar_refs;
241 	/***/ public String metaVar_refspec;
242 	/***/ public String metaVar_remoteName;
243 	/***/ public String metaVar_s3Bucket;
244 	/***/ public String metaVar_s3Region;
245 	/***/ public String metaVar_s3StorageClass;
246 	/***/ public String metaVar_seconds;
247 	/***/ public String metaVar_service;
248 	/***/ public String metaVar_treeish;
249 	/***/ public String metaVar_uriish;
250 	/***/ public String metaVar_url;
251 	/***/ public String metaVar_user;
252 	/***/ public String metaVar_values;
253 	/***/ public String metaVar_version;
254 	/***/ public String mostCommonlyUsedCommandsAre;
255 	/***/ public String needApprovalToDestroyCurrentRepository;
256 	/***/ public String needSingleRevision;
257 	/***/ public String noGitRepositoryConfigured;
258 	/***/ public String noNamesFound;
259 	/***/ public String noSuchFile;
260 	/***/ public String noSuchRemoteRef;
261 	/***/ public String noTREESectionInIndex;
262 	/***/ public String nonFastForward;
263 	/***/ public String noSystemConsoleAvailable;
264 	/***/ public String notABranch;
265 	/***/ public String notACommit;
266 	/***/ public String notAGitRepository;
267 	/***/ public String notAJgitCommand;
268 	/***/ public String notARevision;
269 	/***/ public String notATree;
270 	/***/ public String notAValidRefName;
271 	/***/ public String notAValidCommitName;
272 	/***/ public String notAnIndexFile;
273 	/***/ public String notAnObject;
274 	/***/ public String notFound;
275 	/***/ public String notOnAnyBranch;
276 	/***/ public String noteObjectTooLargeToPrint;
277 	/***/ public String nothingToSquash;
278 	/***/ public String onBranchToBeBorn;
279 	/***/ public String onBranch;
280 	/***/ public String onlyOneMetaVarExpectedIn;
281 	/***/ public String onlyOneOfIncludeOnlyAllInteractiveCanBeUsed;
282 	/***/ public String password;
283 	/***/ public String pathspecDidNotMatch;
284 	/***/ public String pushTo;
285 	/***/ public String pathsRequired;
286 	/***/ public String refDoesNotExistOrNoCommit;
287 	/***/ public String remoteMessage;
288 	/***/ public String remoteRefObjectChangedIsNotExpectedOne;
289 	/***/ public String remoteSideDoesNotSupportDeletingRefs;
290 	/***/ public String removing;
291 	/***/ public String repaint;
292 	/***/ public String s3InvalidBucket;
293 	/***/ public String serviceNotSupported;
294 	/***/ public String skippingObject;
295 	/***/ public String statusFileListFormat;
296 	/***/ public String statusFileListFormatWithPrefix;
297 	/***/ public String statusFileListFormatUnmerged;
298 	/***/ public String statusModified;
299 	/***/ public String statusNewFile;
300 	/***/ public String statusRemoved;
301 	/***/ public String statusBothDeleted;
302 	/***/ public String statusAddedByUs;
303 	/***/ public String statusDeletedByThem;
304 	/***/ public String statusAddedByThem;
305 	/***/ public String statusDeletedByUs;
306 	/***/ public String statusBothAdded;
307 	/***/ public String statusBothModified;
308 	/***/ public String submoduleRegistered;
309 	/***/ public String switchedToNewBranch;
310 	/***/ public String switchedToBranch;
311 	/***/ public String tagAlreadyExists;
312 	/***/ public String tagLabel;
313 	/***/ public String tagNotFound;
314 	/***/ public String taggerInfo;
315 	/***/ public String timeInMilliSeconds;
316 	/***/ public String tooManyRefsGiven;
317 	/***/ public String treeIsRequired;
318 	/***/ public char[] unknownIoErrorStdout;
319 	/***/ public String unknownMergeStrategy;
320 	/***/ public String unknownSubcommand;
321 	/***/ public String unmergedPaths;
322 	/***/ public String unsupportedOperation;
323 	/***/ public String untrackedFiles;
324 	/***/ public String updating;
325 	/***/ public String usernameFor;
326 }