88using System . Windows . Forms ;
99using System . Xml ;
1010
11+ using LiveSplit . Localization ;
1112using LiveSplit . Model ;
1213using LiveSplit . Options ;
1314using LiveSplit . TimeFormatters ;
@@ -21,6 +22,8 @@ namespace LiveSplit.WorldRecord.UI.Components;
2122
2223public class WorldRecordComponent : IComponent
2324{
25+ private static string T ( string source ) => UiLocalizer . Translate ( source , LanguageResolver . ResolveCurrentCultureLanguage ( ) ) ;
26+
2427 protected InfoTextComponent InternalComponent { get ; set ; }
2528
2629 protected WorldRecordSettings Settings { get ; set ; }
@@ -36,7 +39,7 @@ public class WorldRecordComponent : IComponent
3639 private bool IsLoading { get ; set ; }
3740 private SpeedrunComClient Client { get ; set ; }
3841
39- public string ComponentName => "World Record" ;
42+ public string ComponentName => T ( "World Record" ) ;
4043
4144 public float PaddingTop => InternalComponent . PaddingTop ;
4245 public float PaddingLeft => InternalComponent . PaddingLeft ;
@@ -63,7 +66,7 @@ public WorldRecordComponent(LiveSplitState state)
6366 Accuracy = TimeAccuracy . Milliseconds
6467 } ;
6568 PBTimeFormatter = new RegularTimeFormatter ( ) ;
66- InternalComponent = new InfoTextComponent ( "World Record" , TimeFormatConstants . DASH ) ;
69+ InternalComponent = new InfoTextComponent ( T ( "World Record" ) , TimeFormatConstants . DASH ) ;
6770 Settings = new WorldRecordSettings ( )
6871 {
6972 CurrentState = state
@@ -204,18 +207,18 @@ private void ShowWorldRecord(LayoutMode mode)
204207 {
205208 var textList = new List < string >
206209 {
207- string . Format ( "World Record is {0} by {1}" , formatted , runners ) ,
208- string . Format ( "World Record: {0} by {1}" , formatted , runners ) ,
209- string . Format ( "WR: {0} by {1}" , formatted , runners ) ,
210- string . Format ( "WR is {0} by {1}" , formatted , runners )
210+ string . Format ( T ( "World Record is {0} by {1}" ) , formatted , runners ) ,
211+ string . Format ( T ( "World Record: {0} by {1}" ) , formatted , runners ) ,
212+ string . Format ( T ( "WR: {0} by {1}" ) , formatted , runners ) ,
213+ string . Format ( T ( "WR is {0} by {1}" ) , formatted , runners )
211214 } ;
212215
213216 if ( tieCount > 1 )
214217 {
215- textList . Add ( string . Format ( "World Record is {0} ({1}-way tie)" , formatted , tieCount ) ) ;
216- textList . Add ( string . Format ( "World Record: {0} ({1}-way tie)" , formatted , tieCount ) ) ;
217- textList . Add ( string . Format ( "WR: {0} ({1}-way tie)" , formatted , tieCount ) ) ;
218- textList . Add ( string . Format ( "WR is {0} ({1}-way tie)" , formatted , tieCount ) ) ;
218+ textList . Add ( string . Format ( T ( "World Record is {0} ({1}-way tie)" ) , formatted , tieCount ) ) ;
219+ textList . Add ( string . Format ( T ( "World Record: {0} ({1}-way tie)" ) , formatted , tieCount ) ) ;
220+ textList . Add ( string . Format ( T ( "WR: {0} ({1}-way tie)" ) , formatted , tieCount ) ) ;
221+ textList . Add ( string . Format ( T ( "WR is {0} ({1}-way tie)" ) , formatted , tieCount ) ) ;
219222 }
220223
221224 InternalComponent . InformationName = textList . First ( ) ;
@@ -225,32 +228,32 @@ private void ShowWorldRecord(LayoutMode mode)
225228 {
226229 if ( tieCount > 1 )
227230 {
228- InternalComponent . InformationValue = string . Format ( "{0} ({1}-way tie)" , formatted , tieCount ) ;
231+ InternalComponent . InformationValue = string . Format ( T ( "{0} ({1}-way tie)" ) , formatted , tieCount ) ;
229232 }
230233 else
231234 {
232- InternalComponent . InformationValue = string . Format ( "{0} by {1}" , formatted , runners ) ;
235+ InternalComponent . InformationValue = string . Format ( T ( "{0} by {1}" ) , formatted , runners ) ;
233236 }
234237 }
235238 }
236239 else if ( IsLoading )
237240 {
238241 if ( centeredText )
239242 {
240- InternalComponent . InformationName = "Loading World Record..." ;
241- InternalComponent . AlternateNameText = new [ ] { "Loading WR..." } ;
243+ InternalComponent . InformationName = T ( "Loading World Record..." ) ;
244+ InternalComponent . AlternateNameText = new [ ] { T ( "Loading WR..." ) } ;
242245 }
243246 else
244247 {
245- InternalComponent . InformationValue = "Loading..." ;
248+ InternalComponent . InformationValue = T ( "Loading..." ) ;
246249 }
247250 }
248251 else
249252 {
250253 if ( centeredText )
251254 {
252- InternalComponent . InformationName = "Unknown World Record" ;
253- InternalComponent . AlternateNameText = new [ ] { "Unknown WR" } ;
255+ InternalComponent . InformationName = T ( "Unknown World Record" ) ;
256+ InternalComponent . AlternateNameText = new [ ] { T ( "Unknown WR" ) } ;
254257 }
255258 else
256259 {
0 commit comments