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>
This commit is contained in:
David Pursehouse 2016-08-18 15:58:43 +09:00
parent 1bea0227e7
commit 0a86b03eb4
4 changed files with 15 additions and 3 deletions

View 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.
requiredHashFunctionNotAvailable=Required hash function {0} not available.
repositoryNotFound=Repository {0} not found
repositoryReadOnly=Repository {0} is read-only

View File

@ -43,6 +43,10 @@
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));
}
}

View File

@ -43,6 +43,10 @@
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));
}
}

View File

@ -62,4 +62,6 @@ public static LfsText get() {
/***/ public String invalidLongId;
/***/ public String invalidLongIdLength;
/***/ public String requiredHashFunctionNotAvailable;
/***/ public String repositoryNotFound;
/***/ public String repositoryReadOnly;
}