Skip to content

Instantly share code, notes, and snippets.

@hamsterbacke23
Created June 1, 2015 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamsterbacke23/6ac81fbea0b5f94de87c to your computer and use it in GitHub Desktop.
Save hamsterbacke23/6ac81fbea0b5f94de87c to your computer and use it in GitHub Desktop.
concrete5 put lang vars in po
:: usage: c5_getvars.bat", "<searchpath>", "<messages.po-path>", "<file-extension to search>"
SETLOCAL ENABLEDELAYEDEXPANSION :: I wonder what this does ?
:: set extension
SET Extension=%3
SET Extension
CALL :LoCase Extension
SET Extension
:: set lang
SET Language=%3
SET Language
CALL :UpCase Language
SET Language
cd %1
for /R . %%f in (*) do (
if "%%~xf" == ".%Extension%" (
set B=%%f
::take substring of the path
echo Relative !B:%CD%\=!
xgettext !B:%CD%\=! --default-domain=messages --no-location --from-code=utf-8 --keyword=t --language=%Language% -p %2 -j
)
)
ENDLOCAL
GOTO:EOF
:UpCase
:: Subroutine to convert a variable VALUE to all upper case.
:: The argument for this subroutine is the variable NAME.
SET %~1=!%1:a=A!
SET %~1=!%1:b=B!
SET %~1=!%1:c=C!
SET %~1=!%1:d=D!
SET %~1=!%1:e=E!
SET %~1=!%1:f=F!
SET %~1=!%1:g=G!
SET %~1=!%1:h=H!
SET %~1=!%1:i=I!
SET %~1=!%1:j=J!
SET %~1=!%1:k=K!
SET %~1=!%1:l=L!
SET %~1=!%1:m=M!
SET %~1=!%1:n=N!
SET %~1=!%1:o=O!
SET %~1=!%1:p=P!
SET %~1=!%1:q=Q!
SET %~1=!%1:r=R!
SET %~1=!%1:s=S!
SET %~1=!%1:t=T!
SET %~1=!%1:u=U!
SET %~1=!%1:v=V!
SET %~1=!%1:w=W!
SET %~1=!%1:x=X!
SET %~1=!%1:y=Y!
SET %~1=!%1:z=Z!
GOTO:EOF
:LoCase
:: Subroutine to convert a variable VALUE to all lower case.
:: The argument for this subroutine is the variable NAME.
SET %~1=!%1:A=a!
SET %~1=!%1:B=b!
SET %~1=!%1:C=c!
SET %~1=!%1:D=d!
SET %~1=!%1:E=e!
SET %~1=!%1:F=f!
SET %~1=!%1:G=g!
SET %~1=!%1:H=h!
SET %~1=!%1:I=i!
SET %~1=!%1:J=j!
SET %~1=!%1:K=k!
SET %~1=!%1:L=l!
SET %~1=!%1:M=m!
SET %~1=!%1:N=n!
SET %~1=!%1:O=o!
SET %~1=!%1:P=p!
SET %~1=!%1:Q=q!
SET %~1=!%1:R=r!
SET %~1=!%1:S=s!
SET %~1=!%1:T=t!
SET %~1=!%1:U=u!
SET %~1=!%1:V=v!
SET %~1=!%1:W=w!
SET %~1=!%1:X=x!
SET %~1=!%1:Y=y!
SET %~1=!%1:Z=z!
GOTO:EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment