16
16
17
17
package net .fabricmc .mappingio .format ;
18
18
19
+ import java .util .Locale ;
20
+
21
+ import net .fabricmc .mappingio .i18n .I18n ;
22
+ import net .fabricmc .mappingio .i18n .MioLocale ;
23
+
19
24
/**
20
25
* Represents a supported mapping format. Feature comparison table:
21
26
* <table>
@@ -98,55 +103,59 @@ public enum MappingFormat {
98
103
/**
99
104
* The {@code Tiny} mapping format, as specified <a href="https://fabricmc.net/wiki/documentation:tiny">here</a>.
100
105
*/
101
- TINY_FILE ("Tiny file" , " tiny" , true , true , false , false , false ),
106
+ TINY_FILE ("tiny" , true , true , false , false , false ),
102
107
103
108
/**
104
109
* The {@code Tiny v2} mapping format, as specified <a href="https://fabricmc.net/wiki/documentation:tiny2">here</a>.
105
110
*/
106
- TINY_2_FILE ("Tiny v2 file" , " tiny" , true , true , true , true , true ),
111
+ TINY_2_FILE ("tiny" , true , true , true , true , true ),
107
112
108
113
/**
109
114
* Enigma's mapping format, as specified <a href="https://fabricmc.net/wiki/documentation:enigma_mappings">here</a>.
110
115
*/
111
- ENIGMA_FILE ("Enigma file" , " mapping" , false , true , true , true , false ),
116
+ ENIGMA_FILE ("mapping" , false , true , true , true , false ),
112
117
113
118
/**
114
119
* Enigma's mapping format (in directory form), as specified <a href="https://fabricmc.net/wiki/documentation:enigma_mappings">here</a>.
115
120
*/
116
- ENIGMA_DIR ("Enigma directory" , null , false , true , true , true , false ),
121
+ ENIGMA_DIR (null , false , true , true , true , false ),
117
122
118
123
/**
119
124
* The {@code SRG} ({@code Searge RetroGuard}) mapping format, as specified <a href="https://github.com/MinecraftForge/SrgUtils/blob/67f30647ece29f18256ca89a23cda6216d6bd21e/src/main/java/net/minecraftforge/srgutils/InternalUtils.java#L69-L81">here</a>.
120
125
*/
121
- SRG_FILE ("SRG file" , " srg" , false , false , false , false , false ),
126
+ SRG_FILE ("srg" , false , false , false , false , false ),
122
127
123
128
/**
124
129
* The {@code TSRG} ({@code Tiny SRG}, since it saves disk space over SRG) mapping format, as specified <a href="https://github.com/MinecraftForge/SrgUtils/blob/67f30647ece29f18256ca89a23cda6216d6bd21e/src/main/java/net/minecraftforge/srgutils/InternalUtils.java#L196-L213">here</a>.
125
130
*/
126
- TSRG_FILE ("TSRG file" , " tsrg" , false , false , false , false , false ),
131
+ TSRG_FILE ("tsrg" , false , false , false , false , false ),
127
132
128
133
/**
129
134
* The {@code TSRG v2} mapping format, as specified <a href="https://github.com/MinecraftForge/SrgUtils/blob/67f30647ece29f18256ca89a23cda6216d6bd21e/src/main/java/net/minecraftforge/srgutils/InternalUtils.java#L262-L285">here</a>.
130
135
*/
131
- TSRG_2_FILE ("TSRG2 file" , " tsrg" , true , true , false , true , false ),
136
+ TSRG_2_FILE ("tsrg" , true , true , false , true , false ),
132
137
133
138
/**
134
139
* ProGuard's mapping format, as specified <a href="https://www.guardsquare.com/manual/tools/retrace">here</a>.
135
140
*/
136
- PROGUARD_FILE ("ProGuard file" , " txt" , false , true , false , false , false );
141
+ PROGUARD_FILE ("txt" , false , true , false , false , false );
137
142
138
- MappingFormat (String name , String fileExt ,
139
- boolean hasNamespaces , boolean hasFieldDescriptors ,
143
+ MappingFormat (String fileExt , boolean hasNamespaces , boolean hasFieldDescriptors ,
140
144
boolean supportsComments , boolean supportsArgs , boolean supportsLocals ) {
141
- this .name = name ;
142
145
this .fileExt = fileExt ;
146
+ this .translationKey = "format." + name ().toLowerCase (Locale .ROOT );
147
+ this .name = getName (MioLocale .EN_US );
143
148
this .hasNamespaces = hasNamespaces ;
144
149
this .hasFieldDescriptors = hasFieldDescriptors ;
145
150
this .supportsComments = supportsComments ;
146
151
this .supportsArgs = supportsArgs ;
147
152
this .supportsLocals = supportsLocals ;
148
153
}
149
154
155
+ public String getName (MioLocale locale ) {
156
+ return I18n .translate (translationKey , locale );
157
+ }
158
+
150
159
public boolean hasSingleFile () {
151
160
return fileExt != null ;
152
161
}
@@ -157,11 +166,13 @@ public String getGlobPattern() {
157
166
return "*." +fileExt ;
158
167
}
159
168
169
+ /** @deprecated Use {@link #getName()} instead. */
160
170
public final String name ;
161
171
public final String fileExt ;
162
172
public final boolean hasNamespaces ;
163
173
public final boolean hasFieldDescriptors ;
164
174
public final boolean supportsComments ;
165
175
public final boolean supportsArgs ;
166
176
public final boolean supportsLocals ;
177
+ private final String translationKey ;
167
178
}
0 commit comments