]> source.dussan.org Git - jgit.git/commitdiff
LfsRepository{NotFound,ReadOnly}: Externalize message strings 46/79246/2
authorDavid Pursehouse <david.pursehouse@gmail.com>
Thu, 18 Aug 2016 06:58:43 +0000 (15:58 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Sat, 20 Aug 2016 02:24:45 +0000 (11:24 +0900)
Instead of hard-coding the message strings, define them in a properties
file. This will allow them to be translated.

Change-Id: I77556881579e66b2c13d187759c7efdddfee87ae
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.lfs/resources/org/eclipse/jgit/lfs/internal/LfsText.properties
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/LfsRepositoryNotFound.java
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/LfsRepositoryReadOnly.java
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java

index 700e2d50d0877f0b2abed3562730daf62f4a02ba..1c1bbed0e2dc6587ecea1e2b30f58aaf030a9400 100644 (file)
@@ -1,4 +1,6 @@
 incorrectLONG_OBJECT_ID_LENGTH=Incorrect LONG_OBJECT_ID_LENGTH.
 invalidLongId=Invalid id: {0}
 invalidLongIdLength=Invalid id length {0}; should be {1}
-requiredHashFunctionNotAvailable=Required hash function {0} not available.
\ No newline at end of file
+requiredHashFunctionNotAvailable=Required hash function {0} not available.
+repositoryNotFound=Repository {0} not found
+repositoryReadOnly=Repository {0} is read-only
\ No newline at end of file
index 021a100e633f04a8fb7f628ba95f7a978f56d46b..bf94f515dd7a5b602109f33a758bf6a0b7bb8306 100644 (file)
 
 package org.eclipse.jgit.lfs.errors;
 
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.lfs.internal.LfsText;
+
 /**
  * Thrown when the repository does not exist for the user.
  *
@@ -56,6 +60,6 @@ public class LfsRepositoryNotFound extends LfsException {
         *
         */
        public LfsRepositoryNotFound(String name) {
-               super("repository " + name + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
+               super(MessageFormat.format(LfsText.get().repositoryNotFound, name));
        }
 }
index 9de334d703e81bdf9fd66132aed56153ff36b7c6..cab7e19b7227f8d4356d18a3b326a528ff232ccc 100644 (file)
 
 package org.eclipse.jgit.lfs.errors;
 
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.lfs.internal.LfsText;
+
 /**
  * Thrown when the user has read, but not write access. Only applicable when the
  * operation in the request is "upload".
@@ -56,6 +60,6 @@ public class LfsRepositoryReadOnly extends LfsException {
         * @param name
         */
        public LfsRepositoryReadOnly(String name) {
-               super("repository " + name + "is read-only"); //$NON-NLS-1$ //$NON-NLS-2$
+               super(MessageFormat.format(LfsText.get().repositoryReadOnly, name));
        }
 }
index eaffcc90470f2cb599e7baab2542809570762ebc..ae4be6a94706e24162d2bdec6fe04a9c94b3db28 100644 (file)
@@ -62,4 +62,6 @@ public class LfsText extends TranslationBundle {
        /***/ public String invalidLongId;
        /***/ public String invalidLongIdLength;
        /***/ public String requiredHashFunctionNotAvailable;
+       /***/ public String repositoryNotFound;
+       /***/ public String repositoryReadOnly;
 }