Last active
August 29, 2015 14:06
-
-
Save hamsterbacke23/b34285c9f41b9b2aac78 to your computer and use it in GitHub Desktop.
gettext search all files windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: 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 --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