File tree 2 files changed +20
-6
lines changed
2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -46,15 +46,29 @@ static protected void init (String language) {
46
46
}
47
47
48
48
public static String _(String s ) {
49
+ String res ;
49
50
try {
50
- return i18n .getString (s );
51
- }
52
- catch (MissingResourceException e ) {
53
- return s ;
51
+ res = i18n .getString (s );
52
+ } catch (MissingResourceException e ) {
53
+ res = s ;
54
54
}
55
+
56
+ // The single % is the arguments selector in .PO files.
57
+ // We must put double %% inside the translations to avoid
58
+ // getting .PO processing in the way.
59
+ res = res .replace ("%%" , "%" );
60
+
61
+ return res ;
55
62
}
56
63
57
64
public static String format (String fmt , Object ... args ) {
65
+ // Single quote is used to escape curly bracket arguments.
66
+
67
+ // - Prevents strings fixed at translation time to be fixed again
68
+ fmt = fmt .replace ("''" , "'" );
69
+ // - Replace ' with the escaped version ''
70
+ fmt = fmt .replace ("'" , "''" );
71
+
58
72
return MessageFormat .format (fmt , args );
59
73
}
60
74
Original file line number Diff line number Diff line change @@ -1634,12 +1634,12 @@ protected void size(PreferencesMap prefs) throws RunnerException {
1634
1634
long textSize = sizes [0 ];
1635
1635
long dataSize = sizes [1 ];
1636
1636
System .out .println (I18n
1637
- .format (_ ("Binary sketch size: {0} bytes (of a {1} byte maximum) - {2}% used" ),
1637
+ .format (_ ("Binary sketch size: {0} bytes (of a {1} byte maximum) - {2}%% used" ),
1638
1638
textSize , maxTextSize , textSize * 100 / maxTextSize ));
1639
1639
if (dataSize >= 0 ) {
1640
1640
if (maxDataSize > 0 ) {
1641
1641
System .out .println (I18n .format (
1642
- _ ("Minimum Memory usage: {0} bytes (of a {1} byte maximum) - {2}% used" ),
1642
+ _ ("Minimum Memory usage: {0} bytes (of a {1} byte maximum) - {2}%% used" ),
1643
1643
dataSize , maxDataSize , dataSize * 100 / maxDataSize ));
1644
1644
} else {
1645
1645
System .out .println (I18n .format (_ ("Minimum Memory usage: {0} bytes" ), dataSize ));
You can’t perform that action at this time.
0 commit comments