@echo off & setlocal enableextensions

echo.
if not '%1'=='' goto getpar

:usage
echo Generates Intkey, info, and www files.
echo Usage: RUNLAN language
echo where 'language' is de, en, es, or fr.
goto finish

:getpar
for %%p in (de DE) do if %%p==%1 goto de
for %%p in (en EN) do if %%p==%1 goto en
for %%p in (es ES) do if %%p==%1 goto es
for %%p in (fr FR) do if %%p==%1 goto fr
goto usage

:de
set lan=de
goto start

:en
set lan=en
goto start

:es
set lan=es
goto start

:fr
set lan=fr
goto start

:start

call chkdiq_ %lan% || md %lan%
call chkdir_ %lan% || goto abort
call chkdiq_ %lan%\www || md %lan%\www
call chkdiq_ %lan%\info || md %lan%\info

echo.
echo ==============================================================================
echo ===== %lan% =====================================================================
echo ==============================================================================
echo.

echo Confor printch.%lan%
call confor printch.%lan% || goto abort
echo Confor printchx.%lan%
call confor printchx.%lan% || goto abort
echo Confor toint.%lan%
call confor toint.%lan% || goto abort
echo Confor tonath.%lan%
call confor tonath.%lan% || goto abort
echo Confor tonatsr.%lan%
call confor tonatsr.%lan% || goto abort

call finish %lan% || goto abort
goto finish

:abort
echo.
echo  ****** 'runlan.bat %lan%' failed.
exit /b 1

:finish
echo.
exit /b 0
