:Intro
@echo off
echo FreeSpace2 fs2_open.ini
echo Sprachumschalter / Language Selector
echo ====================================
echo Version 1.2.2-NTP vom / from 2021-07-21
echo Erstellt von / Created by
echo Jenna "Novachen" Trassa
echo ------------------------------------
echo.

:Interface
@echo off
echo -----------------------------------------
echo Verfgbare Sprachen / Available Languages
echo -----------------------------------------
echo.
echo [1] Deutsch / German
echo [2] Englisch / English
echo.

set language=0
set /p language="Gewnschte Programmsprache auswhlen / Choose desired program language: "

if %language%==1 goto DE
if %language%==2 goto EN
goto WIEDERHOLUNG

:WIEDERHOLUNG
@echo off
cls
echo FreeSpace2 fs2_open.ini
echo Sprachumschalter / Language Selector
echo ====================================
echo Version 1.2.2-NTP vom / from 2021-07-21
echo Erstellt von / Created by
echo Jenna "Novachen" Trassa
echo ------------------------------------
echo.
echo Du musst eine Auswahl treffen! / You have to make a selection!
echo.
goto Interface

:DE
cls
@echo off
echo FreeSpace2 fs2_open.ini Sprachumschalter
echo ========================================
echo Version 1.2.2-NTP vom 21.07.2021
echo Erstellt von:
echo Jenna "Novachen" Trassa
echo ----------------------------------------
echo.
echo ---------------------------------
echo Verfgbare "FreeSpace 2"-Sprachen
echo ---------------------------------
echo.
echo [1] Standard (Keine bersetzung)
echo [2] Deutsch
echo [3] Franzsisch
echo [4] Italienisch
echo [5] Japanisch
echo [6] Polnisch
echo [7] Spanisch
echo.
echo -------------------------------------------------------------------
echo [V] Programm verlassen
echo [E] Switch to the english interface
echo    (Wechsel zum englischen Interface)
echo.
echo -------------------------------------------------------------------
echo.

set selector.de=0
set /p selector.de="Whle deine gewnschte Spielsprache oder Programmoption: "

if %selector.de%==1 goto FS2D.DE
if %selector.de%==2 goto FS2DE.DE
if %selector.de%==3 goto FS2FR.DE
if %selector.de%==4 goto FS2IT.DE
if %selector.de%==5 goto FS2JP.DE
if %selector.de%==6 goto FS2PL.DE
if %selector.de%==7 goto FS2ES.DE
if %selector.de%==V goto BEENDEN.DE
if %selector.de%==v goto BEENDEN.DE
if %selector.de%==E goto EN
if %selector.de%==e goto EN
goto WIEDERHOLUNG.DE

:EN
cls
@echo off
echo FreeSpace2 fs2_open.ini Language Selector
echo =========================================
echo Version 1.2.2-NTP from 2021-07-21
echo Created by:
echo Jenna "Novachen" Trassa
echo -----------------------------------------
echo.
echo -------------------------------
echo Available FreeSpace 2 Languages
echo -------------------------------
echo.
echo [1] Default (No Translation)
echo [2] French
echo [3] German
echo [4] Italian
echo [5] Japanese
echo [6] Polish
echo [7] Spanish
echo.
echo --------------------------------------------------------------
echo [E] Exit Program
echo [G] Zum deutschen Interface wechseln
echo     (Switch to the german interface)
echo.
echo --------------------------------------------------------------
echo.

set selector.en=0
set /p selector.en="Choose your desired game language or program option: "

if %selector.en%==1 goto FS2D.EN
if %selector.en%==2 goto FS2FR.EN
if %selector.en%==3 goto FS2DE.EN
if %selector.en%==4 goto FS2IT.EN
if %selector.en%==5 goto FS2JP.EN
if %selector.en%==6 goto FS2PL.EN
if %selector.en%==7 goto FS2ES.EN
if %selector.en%==E goto BEENDEN.EN
if %selector.en%==e goto BEENDEN.EN
if %selector.en%==G goto DE
if %selector.en%==g goto DE
goto WIEDERHOLUNG.EN

:WIEDERHOLUNG.DE
@echo off
echo.
echo Du musst eine gltige Auswahl treffen!
timeout /t 2 > nul
echo.
goto DE

:WIEDERHOLUNG.EN
@echo off
echo.
echo You have to make a valid selection!
timeout /t 2 > nul
echo.
goto EN

:BEENDEN.DE
@echo off
echo.
echo Das Programm schlieát sich jetzt.
timeout /t 2 > nul
exit

:BEENDEN.EN
@echo off
echo.
echo The program is closing now.
timeout /t 2 > nul
exit

:FS2DE.DE
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=German"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"

set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i
del "%Quelle%"

if %Zeile%==0 goto :RestDE.DE
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestDE.DE
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Spielsprache erfolgreich auf Deutsch umgestellt!
echo.
timeout /t 2 /nobreak > nul
goto DE

REM FreeSpace2 Umstellung auf Deutsch.



:FS2DE.EN
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=German"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i
del "%Quelle%"

if %Zeile%==0 goto :RestDE.EN
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestDE.EN
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Game Language successfully changed to German!
echo.
timeout /t 2 /nobreak > nul
goto EN

REM FreeSpace 2 Change to German
REM Selection 1

:FS2FR.DE
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=French"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestFR.DE
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestFR.DE
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Spielsprache erfolgreich auf Franzsisch umgestellt!
echo.
timeout /t 2 /nobreak > nul
goto DE

REM FreeSpace2 Umstellung auf Franzsisch

:FS2FR.EN
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=French"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestFR.EN
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestFR.EN
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Game Language successfully changed to French!
echo.
timeout /t 2 /nobreak > nul
goto EN

REM FreeSpace 2 Change to French
REM Selection 2

:FS2IT.DE
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Italian"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestIT.DE
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestFR.DE
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Spielsprache erfolgreich auf Italienisch umgestellt!
echo.
timeout /t 2 /nobreak > nul
goto DE

REM FreeSpace2 Umstellung auf Italienisch

:FS2IT.EN
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Italian"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestIT.EN
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestFR.EN
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Game Language successfully changed to Italian!
echo.
timeout /t 2 /nobreak > nul
goto EN

REM FreeSpace 2 Change to Italian
REM Selection 3

:FS2JP.DE
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Japanese"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestJP.DE
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestJP.DE
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Spielsprache erfolgreich auf Japanisch umgestellt!
echo.
timeout /t 2 /nobreak > nul
goto DE

REM FreeSpace2 Umstellung auf Japanisch

:FS2JP.EN
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Japanese"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"

set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestJP.EN
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestJP.EN
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Game Language successfully changed to Japanese!
echo.
timeout /t 2 /nobreak > nul
goto EN

REM FreeSpace 2 Change to Japanese
REM Selection 4

:FS2PL.DE
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Polish"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestPL.DE
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestPL.DE
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Spielsprache erfolgreich auf Polnisch umgestellt!
echo.
timeout /t 2 /nobreak > nul
goto DE

REM FreeSpace2 Umstellung auf Polnisch

:FS2PL.EN
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Polish"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestPL.EN
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestPL.EN
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Game Language successfully changed to Polish!
echo.
timeout /t 2 /nobreak > nul
goto EN

REM FreeSpace 2 Change to Polish
REM Selection 5

:FS2ES.DE
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Spanish"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestES.DE
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestES.DE
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Spielsprache erfolgreich auf Spanisch umgestellt!
echo.
timeout /t 2 /nobreak > nul
goto DE

REM FreeSpace2 Umstellung auf Spanisch

:FS2ES.EN
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Spanish"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestES.EN
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestES.EN
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Game Language successfully changed to Spanish!
echo.
timeout /t 2 /nobreak > nul
goto EN

REM FreeSpace 2 Change to Spanish
REM Selection 6

:FS2D.DE
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Default"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestD.DE
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestD.DE
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Spielsprache erfolgreich auf Standard zurckgesetzt!
echo.
timeout /t 2 /nobreak > nul
goto DE

REM FreeSpace2 Umstellung auf Standard

:FS2D.EN
@echo off & setlocal
set "FS2Folder=%appdata%\HardLightProductions\FreeSpaceOpen\"
set "Quelle=%appdata%\HardLightProductions\FreeSpaceOpen\fs2_open.ini"
set "Speicher=[Default]"
set "Einfgen=Language=Default"
set "TempIni=%appdata%\HardLightProductions\FreeSpaceOpen\language_change.ini"

findstr /V "Language =Default =German =French =Italian =Japanese =Spanish =Polish" "%Quelle%" > "%TempIni%"
set Zeile=0
for /f "delims=:" %%i in ('findstr /n /i /b /c:"%Speicher%" "%TempIni%"') do set Zeile=%%i

del "%Quelle%"

if %Zeile%==0 goto :RestUnknown.EN
for /f "tokens=1* delims=:" %%i in ('findstr /n $ "%TempIni%"') do if %%i leq %Zeile% echo.%%j>>"%Quelle%"

echo %Einfgen%>>"%Quelle%"

:RestUnknown.EN
more +%Zeile% "%TempIni%">>"%Quelle%"
del "%TempIni%"
timeout /t 2 /nobreak > nul
cls
echo.
echo Game language successfully reset to default!
echo.
timeout /t 2 /nobreak > nul
goto EN

REM FreeSpace 2 Change to Default
REM Selection 7
