1- using System ;
1+ using System ;
22using System . Collections ;
33using System . Diagnostics ;
44using System . Text . RegularExpressions ;
@@ -68,7 +68,7 @@ public void Show(string ip, int port)
6868 serverPort = port ;
6969
7070 //Set Server IP in info label
71- lowerDetailTextGameObject . GetComponent < Text > ( ) . text = $ "Server IP Address \n { serverIp } ";
71+ lowerDetailTextGameObject . GetComponent < Text > ( ) . text = $ "{ Language . main . Get ( "Nitrox_JoinServerIpAddress" ) } \n { serverIp } ";
7272
7373 //Initialize elements from preferences
7474 activePlayerPreference = preferencesManager . GetPreference ( serverIp ) ;
@@ -173,17 +173,17 @@ private void StartMultiplayerClient()
173173 }
174174 catch ( ClientConnectionFailedException )
175175 {
176- Log . InGameSensitive ( "Unable to contact the remote server at: {ip}:{port}", serverIp , serverPort ) ;
176+ Log . InGameSensitive ( Language . main . Get ( "Nitrox_UnableToConnect" ) + " {ip}:{port}", serverIp , serverPort ) ;
177177
178178 if ( serverIp . Equals ( "127.0.0.1" ) )
179179 {
180180 if ( Process . GetProcessesByName ( "NitroxServer-Subnautica" ) . Length == 0 )
181181 {
182- Log . InGame ( "Start your server first to join your self-hosted world" ) ;
182+ Log . InGame ( Language . main . Get ( "Nitrox_StartServer" ) ) ;
183183 }
184184 else
185185 {
186- Log . InGame ( "Seems like your firewall settings are interfering" ) ;
186+ Log . InGame ( Language . main . Get ( "Nitrox_FirewallInterfering" ) ) ;
187187 }
188188 }
189189 OnCancelClick ( ) ;
@@ -204,7 +204,7 @@ private void OnJoinClick()
204204 //https://regex101.com/r/eTWiEs/2/
205205 if ( ! Regex . IsMatch ( playerName , @"^[a-zA-Z0-9._-]{3,25}$" ) )
206206 {
207- NotifyUser ( "Please enter a valid player name ! \n \n It must not contain any space or doubtful characters \n Allowed characters : A-Z a-z 0-9 _ . - \n Length : [3, 25]" ) ;
207+ NotifyUser ( Language . main . Get ( "Nitrox_InvalidUserName" ) ) ;
208208 return ;
209209 }
210210 preferencesManager . SetPreference ( serverIp , new PlayerPreference ( playerName , colorPicker . currentColor ) ) ;
@@ -219,23 +219,23 @@ private void SessionConnectionStateChangedHandler(IMultiplayerSessionConnectionS
219219 switch ( state . CurrentStage )
220220 {
221221 case MultiplayerSessionConnectionStage . ESTABLISHING_SERVER_POLICY :
222- Log . InGame ( "Requesting session policy information..." ) ;
222+ Log . InGame ( Language . main . Get ( "Nitrox_RequestingSessionPolicy" ) ) ;
223223 break ;
224224
225225 case MultiplayerSessionConnectionStage . AWAITING_RESERVATION_CREDENTIALS :
226226 if ( multiplayerSession . SessionPolicy . RequiresServerPassword )
227227 {
228- Log . InGame ( "Waiting for Server Password Input..." ) ;
228+ Log . InGame ( Language . main . Get ( "Nitrox_WaitingPassword" ) ) ;
229229 showingPasswordWindow = true ;
230230 shouldFocus = true ;
231231 }
232- Log . InGame ( "Waiting for user input..." ) ;
232+ Log . InGame ( Language . main . Get ( "Nitrox_WaitingUserInput" ) ) ;
233233 rightSideMainMenu . OpenGroup ( "Join Server" ) ;
234234 FocusPlayerNameTextbox ( ) ;
235235 break ;
236236
237237 case MultiplayerSessionConnectionStage . SESSION_RESERVED :
238- Log . InGame ( "Launching game..." ) ;
238+ Log . InGame ( Language . main . Get ( "Nitrox_LaunchGame" ) ) ;
239239 multiplayerSession . ConnectionStateChanged -= SessionConnectionStateChangedHandler ;
240240 preferencesManager . Save ( ) ;
241241
@@ -248,7 +248,7 @@ private void SessionConnectionStateChangedHandler(IMultiplayerSessionConnectionS
248248 break ;
249249
250250 case MultiplayerSessionConnectionStage . SESSION_RESERVATION_REJECTED :
251- Log . InGame ( "Reservation rejected..." ) ;
251+ Log . InGame ( Language . main . Get ( "Nitrox_RejectedSessionPolicy" ) ) ;
252252
253253 MultiplayerSessionReservationState reservationState = multiplayerSession . Reservation . ReservationState ;
254254
@@ -350,8 +350,7 @@ private void InitializeButtonElements()
350350
351351 RectTransform cancelButtonTransform = ( RectTransform ) cancelButtonGameObject . transform ;
352352 GameObject cancelButtonTextGameObject = cancelButtonTransform . RequireGameObject ( "Text" ) ;
353- Text cancelButtonText = cancelButtonTextGameObject . GetComponent < Text > ( ) ;
354- cancelButtonText . text = "Cancel" ;
353+ cancelButtonTextGameObject . GetComponent < Text > ( ) . text = Language . main . Get ( "Nitrox_Cancel" ) ;
355354
356355 cancelButtonTransform . sizeDelta = new Vector2 ( cancelButtonTransform . rect . width * 0.85f , cancelButtonTransform . rect . height ) ;
357356 cancelButtonTransform . anchoredPosition = new Vector2 (
@@ -368,8 +367,7 @@ private void InitializeButtonElements()
368367 joinButtonTransform . Rotate ( Vector3 . forward * - 180 ) ;
369368
370369 GameObject joinButtonTextGameObject = joinButtonTransform . RequireGameObject ( "Text" ) ;
371- Text joinButtonText = joinButtonTextGameObject . GetComponent < Text > ( ) ;
372- joinButtonText . text = "Join" ;
370+ joinButtonTextGameObject . GetComponent < Text > ( ) . text = Language . main . Get ( "Nitrox_Join" ) ;
373371
374372 //Flip the text so it is no longer upside down after flipping the button.
375373 RectTransform joinButtonTextRectTransform = ( RectTransform ) joinButtonTextGameObject . transform ;
@@ -475,8 +473,7 @@ private void InitializeBaseTabElement()
475473 baseTabSelectedColorImage . rectTransform . anchoredPosition . x + baseTabTextTransform . rect . width / 2f + 22f ,
476474 baseTabSelectedColorImage . rectTransform . anchoredPosition . y ) ;
477475
478- Text baseTabText = baseTabTextGameObject . GetComponent < Text > ( ) ;
479- baseTabText . text = "Player Color" ;
476+ baseTabTextGameObject . GetComponent < Text > ( ) . text = Language . main . Get ( "Nitrox_PlayerColor" ) ;
480477
481478 //This resizes the actual Image that outlines all of the UI elements.
482479 GameObject baseTabBackgroundGameObject = baseTabTransform . RequireGameObject ( "Background" ) ;
@@ -535,8 +532,7 @@ private void InitializePlayerNameInputElement()
535532 playerNameInputField . selectionColor = Color . white ;
536533
537534 GameObject inputFieldPlaceholder = inputFieldRectTransform . RequireGameObject ( "Placeholder" ) ;
538- Text inputFieldPlaceholderText = inputFieldPlaceholder . GetComponent < Text > ( ) ;
539- inputFieldPlaceholderText . text = "Enter Player Name" ;
535+ inputFieldPlaceholder . GetComponent < Text > ( ) . text = Language . main . Get ( "Nitrox_EnterName" ) ;
540536 }
541537
542538 //This is the "service" that manages the click and drag events on the color picture RectTransform.
@@ -606,18 +602,18 @@ private void DoServerPasswordWindow(int windowId)
606602 {
607603 using ( new GUILayout . HorizontalScope ( ) )
608604 {
609- GUILayout . Label ( "Password:" ) ;
605+ GUILayout . Label ( Language . main . Get ( "Nitrox_JoinServerPassword" ) ) ;
610606 GUI . SetNextControlName ( "serverPasswordField" ) ;
611607 serverPassword = GUILayout . TextField ( serverPassword ) ;
612608 }
613609
614- if ( GUILayout . Button ( "Submit Password" ) )
610+ if ( GUILayout . Button ( Language . main . Get ( "Nitrox_SubmitPassword" ) ) )
615611 {
616612 HidePasswordWindow ( ) ;
617613 OnSubmitPasswordButtonClicked ( ) ;
618614 }
619615
620- if ( GUILayout . Button ( "Cancel" ) )
616+ if ( GUILayout . Button ( Language . main . Get ( "Nitrox_Cancel" ) ) )
621617 {
622618 HidePasswordWindow ( ) ;
623619 OnCancelClick ( ) ;
0 commit comments