Localized SecondsToString method in DurationUtils
Added compact SecondsToShortString method to DurationUtils
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package eu.crushedpixel.replaymod.utils;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
public class DurationUtils {
|
||||
|
||||
public static String convertSecondsToString(int seconds) {
|
||||
@@ -8,9 +10,22 @@ public class DurationUtils {
|
||||
int sec = seconds - ((min*60) + (hours*60*60));
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if(hours > 0) builder.append(hours).append("h ");
|
||||
if(min > 0 || hours > 0) builder.append(min).append("min ");
|
||||
builder.append(sec).append("sec");
|
||||
if(hours > 0) builder.append(hours).append(I18n.format("replaymod.gui.hours"));
|
||||
if(min > 0 || hours > 0) builder.append(min).append(I18n.format("replaymod.gui.minutes"));
|
||||
builder.append(sec).append(I18n.format("replaymod.gui.seconds"));
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static String convertSecondsToShortString(int seconds) {
|
||||
int hours = seconds/(60*60);
|
||||
int min = seconds/60 - hours*60;
|
||||
int sec = seconds - ((min*60) + (hours*60*60));
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if(hours > 0) builder.append(String.format("%02d", hours)).append(":");
|
||||
builder.append(String.format("%02d", min)).append(":");
|
||||
builder.append(String.format("%02d", sec));
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ replaymod.gui.pleasewait=Please wait
|
||||
replaymod.gui.render=Render
|
||||
replaymod.gui.iphidden=Server IP Hidden
|
||||
|
||||
replaymod.gui.hours=h
|
||||
replaymod.gui.minutes=min
|
||||
replaymod.gui.seconds=sec
|
||||
replaymod.gui.milliseconds=ms
|
||||
@@ -145,6 +146,8 @@ replaymod.gui.center.favorite=Favorite
|
||||
replaymod.gui.center.unfavorite=Unfavorite
|
||||
replaymod.gui.center.favorites=Favorites
|
||||
|
||||
replaymod.gui.center.author=by %1$s%2$s
|
||||
|
||||
#Upload GUI
|
||||
replaymod.gui.upload.title=Upload File
|
||||
replaymod.gui.upload.start=Start Upload
|
||||
|
||||
Reference in New Issue
Block a user