Browse Source

LfsRepository{NotFound,ReadOnly}: Externalize message strings

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>
stable-4.5
David Pursehouse 8 years ago
parent
commit
0a86b03eb4
  1. 4
      org.eclipse.jgit.lfs/resources/org/eclipse/jgit/lfs/internal/LfsText.properties
  2. 6
      org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/LfsRepositoryNotFound.java
  3. 6
      org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/LfsRepositoryReadOnly.java
  4. 2
      org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java

4
org.eclipse.jgit.lfs/resources/org/eclipse/jgit/lfs/internal/LfsText.properties

@ -1,4 +1,6 @@
incorrectLONG_OBJECT_ID_LENGTH=Incorrect LONG_OBJECT_ID_LENGTH. incorrectLONG_OBJECT_ID_LENGTH=Incorrect LONG_OBJECT_ID_LENGTH.
invalidLongId=Invalid id: {0} invalidLongId=Invalid id: {0}
invalidLongIdLength=Invalid id length {0}; should be {1} invalidLongIdLength=Invalid id length {0}; should be {1}
requiredHashFunctionNotAvailable=Required hash function {0} not available. requiredHashFunctionNotAvailable=Required hash function {0} not available.
repositoryNotFound=Repository {0} not found
repositoryReadOnly=Repository {0} is read-only

6
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/LfsRepositoryNotFound.java

@ -43,6 +43,10 @@
package org.eclipse.jgit.lfs.errors; 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. * Thrown when the repository does not exist for the user.
* *
@ -56,6 +60,6 @@ public class LfsRepositoryNotFound extends LfsException {
* *
*/ */
public LfsRepositoryNotFound(String name) { public LfsRepositoryNotFound(String name) {
super("repository " + name + " not found"); //$NON-NLS-1$ //$NON-NLS-2$ super(MessageFormat.format(LfsText.get().repositoryNotFound, name));
} }
} }

6
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/LfsRepositoryReadOnly.java

@ -43,6 +43,10 @@
package org.eclipse.jgit.lfs.errors; 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 * Thrown when the user has read, but not write access. Only applicable when the
* operation in the request is "upload". * operation in the request is "upload".
@ -56,6 +60,6 @@ public class LfsRepositoryReadOnly extends LfsException {
* @param name * @param name
*/ */
public LfsRepositoryReadOnly(String name) { public LfsRepositoryReadOnly(String name) {
super("repository " + name + "is read-only"); //$NON-NLS-1$ //$NON-NLS-2$ super(MessageFormat.format(LfsText.get().repositoryReadOnly, name));
} }
} }

2
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java

@ -62,4 +62,6 @@ public class LfsText extends TranslationBundle {
/***/ public String invalidLongId; /***/ public String invalidLongId;
/***/ public String invalidLongIdLength; /***/ public String invalidLongIdLength;
/***/ public String requiredHashFunctionNotAvailable; /***/ public String requiredHashFunctionNotAvailable;
/***/ public String repositoryNotFound;
/***/ public String repositoryReadOnly;
} }

Loading…
Cancel
Save