More translation stuff.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1477 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-15 12:23:47 +00:00
parent a0b5e8d0f8
commit e70195b170
3 changed files with 11 additions and 7 deletions

View File

@ -102,7 +102,10 @@ public class Util
fromDate.add(type, future ? -1 : 1);
return diff;
}
private static Pattern timePattern = Pattern.compile(
public static long parseDateDiff(String time, boolean future) throws Exception
{
Pattern timePattern = Pattern.compile(
"(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?"
@ -110,9 +113,6 @@ public class Util
+ "(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?"
+ "(?:([0-9]+)\\s*(?:s[a-z]*)?)?", Pattern.CASE_INSENSITIVE);
public static long parseDateDiff(String time, boolean future) throws Exception
{
Matcher m = timePattern.matcher(time);
int years = 0;
int months = 0;
@ -171,7 +171,7 @@ public class Util
}
if (!found)
{
throw new Exception("Illegal date format.");
throw new Exception(Util.i18n("illegalDate"));
}
Calendar c = new GregorianCalendar();
if (years > 0)

View File

@ -301,4 +301,6 @@ worth = \u00a77Stack of {0} worth \u00a7c{1}\u00a77 ({2} item(s) at {3} each)
worthMeta = \u00a77Stack of {0} with metadata of {1} worth \u00a7c{2}\u00a77 ({3} item(s) at {4} each)
onlyPlayers = Only in-game players can use {0}.
unignorePlayer = You are not ignoring player {0} anymore.
ignorePlayer = You ignore player {0} from now on.
ignorePlayer = You ignore player {0} from now on.
illegalDate = Illegal date format.
timePattern = (?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)?

View File

@ -301,4 +301,6 @@ worth = \u00a77Stack of {0} worth \u00a7c{1}\u00a77 ({2} item(s) at {3} each)
worthMeta = \u00a77Stack of {0} with metadata of {1} worth \u00a7c{2}\u00a77 ({3} item(s) at {4} each)
onlyPlayers = Only in-game players can use {0}.
unignorePlayer = You are not ignoring player {0} anymore.
ignorePlayer = You ignore player {0} from now on.
ignorePlayer = You ignore player {0} from now on.
illegalDate = Illegal date format.
timePattern = (?:([0-9]+)\\s*[yj][a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*[dt][a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:h|st)[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)?