Always frustrated to manually perform these 3 steps
1) viewbin.exe nk.bin => write down START and LENGTH
2) cvrtbin -r -a START -w 32 -l LENGTH nk.bin
3) dumprom.exe -d dump -v -5 nk.nb0
Click to expand...
Click to collapse
needed to dump a NK.BIN? You can get helped by using CREATEDUMP.BAT instead, a one-click-solution.
Supposed you already have folder 'Nkbintools' at your desktop PC, you simply put CREATEDUMP.BAT in folder 'Nkbintools', also copy the NK.BIN file to be dumped into folder 'Nkbintools' and run CREATEDUMP.BAT.
Code:
@ECHO OFF
cls
REM Purpose: This batch file creates complete dump of NK.BIN provided
REM Author: jwoegerbauer
REM Date: 2013-01-03
REM License: GPL v3
REM
:START
if "%~1" == "" (
echo CREATEDUMP.BAT&echo Using NK.BIN in current directory
set nkbin=nk.bin
) else (
set nkbin="%~1"
)
setlocal enabledelayedexpansion
if not exist %nkbin% goto :FAILURE1
REM clean up
if exist viewbin.txt del viewbin.txt
if exist nk.nb0 del nk.nb0
REM determine start and length of NK.BIN
echo Determining exact length of %nkbin% ...
viewbin %nkbin% > viewbin.txt
if not exist viewbin.txt goto :FAILURE2
REM
REM that's how contents of first 2 lines of file viewbin.txt might look
REM ViewBin... nk.bin
REM Image Start = 0x80100000, length = 0x01EDAD34
REM
set start=""
set length=""
for /f "skip=1 tokens=2,4 delims=,=" %%A in (viewbin.txt) do (
set start=%%A
for /f %%N in ("%%A") do set start=%%N
set length=%%B
for /f %%N in ("%%B") do set length=%%N
goto :BREAK
)
:BREAK
if ".%start%" == "." goto :FAILURE3
if ".%length%" == "." goto :FAILURE3
REM convert the nk.bin provided to a nk.nb0
echo Converting %nkbin% to nk.nb0 ...
cvrtbin -r -a %start% -w 32 -l %length% %nkbin% > NUL
if not exist nk.nb0 goto :FAILURE4
REM content of the nk.nb0 will be written in the directory "dump".
REM directory dump must exist, otherwise an error occurs.
mkdir dump > NUL
echo Extracting all files and modules from the kernel&echo This may take some minutes ...
dumprom -d dump -v -5 nk.nb0 > NUL
echo Dumping finshed&echo Dumped files should be in ..\dump&goto :END
:FAILURE1
echo Error:&echo File nk.bin not found&echo Aborting ...&goto :END
:FAILURE2
echo Error:&echo Failed to create file viewbin.txt&echo Aborting ...&goto :END
:FAILURE3
echo Error:&echo Failed to determine image's start and/or length&echo Aborting ...&goto :END
:FAILURE4
echo Error:&echo Failed to create temporary file nk.nb0&echo Aborting ...
:END
endlocal
pause
@ECHO ON
exit
For your convenience I have uploaded the whole 'Nkbintools' package here.
UPDATE:
The Dumprom.exe in 'Nkbintools' package provided sets the 'machine type" for all PE-files dumped as MIPS R4000. Might be that's not what you wanted. Hence you should know that Dumprom.exe contains at offset 0x1E64 the "machine type" for the PE-files it generates.
Examples:
C0 01 => 0x1C0 => ARM
C2 01 => 0x1C2 => ARM Thumb
66 01 => 0x166 => MIPS R4000
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Advice: Simply hex-edit Dumprom.exe ...
And you always can manually rewrite each dumped PE-file's "machine type" using CFF Explorer ...
Enjoy!
corrected [BATCH]CREATEDUMP.BAT - Dumping a NK.BIN made easy
Thanks for the script. Here is the batch working also within Win7 command prompt:
Code:
@ECHO OFF
cls
REM Purpose: This batch file creates complete dump of NK.BIN provided
REM Author: jwoegerbauer
REM Date: 2013-01-03
REM License: GPL v3
REM
:START
if "%~1" == "" (
echo CREATEDUMP.BAT&echo Using NK.BIN in current directory
set nkbin=nk.bin
) else (
set nkbin="%~1"
)
echo Using %nkbin%
REM pause
setlocal enabledelayedexpansion
if not exist %nkbin% goto :FAILURE1
REM clean up
if exist viewbin.txt del viewbin.txt
if exist nk.nb0 del nk.nb0
REM determine start and length of NK.BIN
echo Determining exact length of %nkbin% ...
REM remove double quotes around var as viewbin does not like these
set nkbin=%nkbin:"=%
viewbin.exe %nkbin% > viewbin.txt
REM pause
if not exist viewbin.txt goto :FAILURE2
REM
REM that's how contents of first 2 lines of file viewbin.txt might look
REM ViewBin... nk.bin
REM Image Start = 0x80100000, length = 0x01EDAD34
REM
set start=""
set length=""
for /f "skip=1 tokens=2,4 delims=,=" %%A in (viewbin.txt) do (
set start=%%A
for /f %%N in ("%%A") do set start=%%N
set length=%%B
for /f %%N in ("%%B") do set length=%%N
goto :BREAK
)
:BREAK
if ".%start%" == "." goto :FAILURE3
if ".%length%" == "." goto :FAILURE3
REM convert the nk.bin provided to a nk.nb0
set NKBIN0=%nkbin:.bin=.nb0%
echo Converting %nkbin% to %NKBIN0% ...
cvrtbin -r -a %start% -w 32 -l %length% %nkbin% > NUL
if not exist %NKBIN0% goto :FAILURE4
REM content of the nk.nb0 will be written in the directory "dump".
REM directory dump must exist, otherwise an error occurs.
mkdir dump > NUL
echo Extracting all files and modules from the kernel&echo This may take some minutes ...
dumprom -d dump -v -5 %NKBIN0% > NUL
echo Dumping finshed&echo Dumped files should be in ..\dump&goto :END
:FAILURE1
echo Error:&echo File nk.bin not found&echo Aborting ...&goto :END
:FAILURE2
echo Error:&echo Failed to create file viewbin.txt&echo Aborting ...&goto :END
:FAILURE3
echo Error:&echo Failed to determine image's start and/or length&echo Aborting ...&goto :END
:FAILURE4
echo Error:&echo Failed to create temporary file nb0 file&echo Aborting ...
:END
endlocal
pause
@ECHO ON
REM exit
THANKS
This tutorial is going to help ROM chiefs on how to add and integrate different languages and csc codes from different regions in their cooked custom ROM
Have you ever wanted to port your language across custom ROMs but you don't know how?
Yes after searching the xda, you knew that you need to integrate your language value folder in each ROM apk in order to have your language ported to the custom ROM; however heh, it will be very long journey of decompiling and compiling, making integrating your language value folder in each ROM apk is like a hell..!!
So from this side, I decided to make a tool that will decompile and extract languages values folders and after extracting all values folders from all apks of the same name (e.g, SystemUI.apk) from all ROMs' different regions, you can integrate all languages in one multi-languages apk; making the whole process a much less painful than the manual way..!!
So in short, this tool will add languages from ROM's apk files to another of the same name..
How to use:
1. Run apk-lang-extractor.bat file; this will create all needed folders.
2. Install your ROM dependencies (Only once) by putting them in "put-dependencies-here" folder and choose option #0.
3. Put all same apks from different region ROM's releases in "put-apk-here" folder; you can give them numbers in order to not get confused; ensure no space in apk name (e.g, SystemUI1.apk, SystemUI2.apk, SystemUI3.apk... etc).
4. Set Current-apk for one of them (option #1), and start extracting job (option #2) and do the same for the rest of apk files.
5. Let the apk file that you will integrate all languages in to be the last apk to extract the languages from; this is important to ensure the least error during compiling.
6. After you extracted all languages from all apk files, and being the last extracted apk is set as Current-apk, start languages integrating process (option #3) that will result in one apk file that contains all extracted languages. :laugh:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Credits:
1. Igor Pavlov: for 7za command line.
2. Brut.all & iBotPeaches: for the awesome apktool.jar :good:
3. atomicdryad: for SignApk.jar
4. Google: for android SDK
and to dedicate the contribution of such elite developers, the credits are shown in the utility splash screen..
- apk-languages-Extractor-Integrator_v1.05 @19/July/2013 - [the most recent]
- apk-languages-Extractor-Integrator_v1.00 @ 17/July/2013 - [old]
Change-log:
@ 19/July/2013 (v1.05):
- Fixed error message during language integration "The process cannot access the file because it is being used by another process".
- Fixed compression function. Now the whole final apk file is compressed by level specified, instead of signature only (my bad!!).
- Fixed open "finished-apk" folder delay after language integrating process.
- Deleting existing signed file apk of same name before signing (no more overlapping).
- New option added in the main menu to link the utility with this thread page (you can check update anytime now).
@ 17/July/2013 (v1.00):
- First release.
You just finished integrating languages values folders in each apk file in your custom ROM; however, we haven't finish porting languages yet..!! Continue with the next post
<<In this post, we will concentrate on making the added languages visible and usable in your cooked ROM. Also we will learn how to add different CSC code regions in the cooked ROM>>
How to add languages to language display and language input:
1. Navigate to system\csc\common\system\csc folder and open language.xml file. Here we will concentrate in this section:
Code:
<LanguageSet>
[B][COLOR="Blue"]<Display>[/COLOR][/B] [B][COLOR="Green"]<!-- This section is for displayed languages[/COLOR][/B]
en_GB;en_US;fr_FR;
ar_AE;fa_FA;ur_PK;
</Display>
[B][COLOR="Blue"]<Input>[/COLOR][/B] [B][COLOR="Green"]<!-- This section is for input languages[/COLOR][/B]
<SupportList>
en_GB;en_US;fr;ar;fa;ur;
</SupportList>
<EnableList>
</EnableList>
</Input>
</LanguageSet>
for each section you can add iso code language for each region. Here is the code again after applying iso code languages:
Code:
<LanguageSet>
<Display>
en_GB;ar_AE;az_AZ;bg_BG;ca_ES;cs_CZ;da_DK;de_AT;de_CH;de_DE;
el_GR;en_AU;en_IE;en_NZ;en_PH;en_US;en_ZA;es_ES;es_US;et_EE;
eu_ES;f_FI;fa_FA;fr_CH;fr_FR;ga_IE;gl_ES;hr_HR;hu_HU;hy_AM;
in_ID;is_IS;it_IT;ka_GE;kk_KZ;ko_KR;lt_LT;lv_LV;mk_MK;ms_MY;
nb_NO;nl_BE;nl_NL;pl_PL;pt_BR;pt_PT;ro_RO;ru_RU;sk_SK;sl_SI;
sr_RS;sv_SE;th_TH;tr_TR;ur_PK;uk_UA;uz_UZ;vi_VN;zh_CN;zh_HK;
zh_TW;
</Display>
<Input>
<SupportList>
en_GB;ar;az;bg;bn;ca;cs;da;de;el;
en_US;es;et;eu;fa;fi;fr;gl;gu;hi;
hr;hu;hy;id;is;it;ka;kk;kn;ko;
lt;lv;ml;ms;mr;nb;nl;pa;pl;pt;
ro;ru;sk;sl;sr;sv;ta;te;th;tr;
uk;ur;vi;zh_CN;
</SupportList>
<EnableList>
</EnableList>
</Input>
</LanguageSet>
of course after extracting a lot of ROMs from specific regions, you can just add their iso code language in your cooked ROM language.xml after having the iso codes from their language.xml files
2. Now copy this modified language.xml and paste it on system\csc directory
3. Now to display language name in your device, you need to decompile ResourceManager.apk and navigate to res\values folder and open strings.xml and add new languages resources strings there in this form:
Code:
<string name="vo_rm_authority">com.visionobjects.resourcemanager</string>
<string name="[B][COLOR="Red"]en_GB[/COLOR][/B]">[B][COLOR="Blue"]English(UK)[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]en_US[/COLOR][/B]">[B][COLOR="Blue"]English(US)[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]az[/COLOR][/B]">[B][COLOR="Blue"]Azərbaycan[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]ca[/COLOR][/B]">[B][COLOR="Blue"]Català[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]cs[/COLOR][/B]">[B][COLOR="Blue"]Čeština[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]da[/COLOR][/B]">[B][COLOR="Blue"]Dansk[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]de[/COLOR][/B]">[B][COLOR="Blue"]Deutsch[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]et[/COLOR][/B]">[B][COLOR="Blue"]Eesti[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]es[/COLOR][/B]">[B][COLOR="Blue"]Español[/COLOR][/B]</string>
..
..
[B][COLOR="Green"]and so on[/COLOR][/B]
Here the red texts are regional iso codes for the added language, and the blue texts are the displayed language name in your device (you can decompile ResourceManager.apk from different ROMs' regions in order to have the iso codes and the corresponding languages strings).
4. Now you need to add input database for different languages. After extracting different ROMs' regions, copy all the content of system\T9DB and paste it in same directory of the ROM that you will make it support different languages.
N.B: To have all input languages activated, you need to add all values folder in the ROM keyboard app for the specific language you want to activate.
Click to expand...
Click to collapse
5. Now you will need to integrate languages data base; after extracting different ROMs' regions, copy all the content of system\hdic folder and paste it in same directory of the ROM that you will make it support different languages.
How to set default language in initial setup wizard:
Go to system\csc folder and open customer.xml and edit this section:
Code:
<Phone>
<DefLanguage>[B][COLOR="Blue"]ar_AE[/COLOR][/B]</DefLanguage>
<DefLanguageNoSIM>[B][COLOR="Blue"]ar_AE[/COLOR][/B]</DefLanguageNoSIM>
<DateTimeFormat>
<DateFormat>ddmmyyyy</DateFormat>
</DateTimeFormat>
<VisiblePassword>off</VisiblePassword>
</Phone>
Just change the blue colored iso code and substitute it with your favorite one from language.xml display section
CSC codes:
How to set default csc code:
Go to system\csc\%yourCSCfolder%\system\csc folder and copy all its content (usually contents.db, customer.xml, others.xml, and sales_code.dat) and paste it on system\csc directory.
Alternatively, you can edit the files in system\csc folder that includes:
customer.xml
Code:
<SalesCode>[B][COLOR="Blue"]KSA[/COLOR][/B]</SalesCode>
change it to your csc iso code (that is the csc folder name in system\csc folder).
language.xml:
Code:
<SalesCode>[B][COLOR="Blue"]KSA[/COLOR][/B]</SalesCode>
the same as change in customer.xml
sales_code.dat
Code:
[B][COLOR="Blue"]KSA[/COLOR][/B]
the same as change in customer.xml
How to add extra CSC codes:
After extracting all CSC folders from different ROMs region, first copy and paste them in system\csc folder then you need to go to system directory and open SW_Configuration.xml and add all CSC folders you just paste:
Code:
<NbCustomer>[B][COLOR="Blue"]67[/COLOR][/B]</NbCustomer> [B][COLOR="Green"]<!-- Here enter how many csc code folders you have in system\csc[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ABS[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]AFG[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]AFR[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |--- Here add CSC folders[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ALO[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ARB[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
..
..
[B][COLOR="Green"]and so on[/COLOR][/B]
And now you are ready to create your multi-languages and multi-csc ROM,,
For developers only..!!
Here is all codes I used to build up this utility, any suggestion for improvement is welcomed.. !!
Real CMD codes language used in the utility (v1.05):
Code:
@echo off
setlocal enabledelayedexpansion
COLOR 0A
title [APK LANGUAGES EXTRACTOR TOOL - majdinj - xda]
if (%1)==(0) goto logo
mode con:cols=64 lines=55
echo.
echo.
echo **************************************************
echo **************************************************
echo ** **
echo ** Checking java version... **
echo ** **
echo **************************************************
echo **************************************************
echo.
java -version
IF errorlevel 1 goto errjava
echo.
echo.
echo Java is installed on your machine...
echo.
echo.
ECHO.
ECHO.
ECHO.
echo **************************************************
echo **************************************************
echo ** **
echo ** USED TOOLS, VERSIONS AND CREDITS **
echo ** **
echo **************************************************
echo **************************************************
ECHO.
cd "%~dp0tools"
type versions.txt
echo.
echo WELCOME TO ANDROID APK LANGUAGES EXTRACTOR AND INTEGRATOR TOOL
ECHO BY: majdinj - XDA-DEVELOPERS.COM
echo.
echo.
echo.
echo.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
PAUSE
cd "%~dp0"
set capp=None
set heap=1024
set comp=9
set /A count=0
FOR %%F IN (put-apk-here/*.apk) DO (
set /A count+=1
set tmpstore=%%~nF%%~xF
)
if %count%==1 (set capp=%tmpstore%)
IF NOT EXIST "%~dp0/put-apk-here" mkdir put-apk-here
IF NOT EXIST "%~dp0/put-dependencies-here" mkdir put-dependencies-here
IF NOT EXIST "%~dp0/extracted-languages" mkdir extracted-languages
IF NOT EXIST "%~dp0/finished-apk" mkdir finished-apk
IF NOT EXIST "%~dp0/temp" mkdir temp
echo. >> log.log
echo. >> log.log
echo ---------------------------------------------------------------------------- >> log.log
echo ^|%date% -- %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%^| >> log.log
echo ---------------------------------------------------------------------------- >> log.log
apk-lang-extractor.bat 0 2>> log.log
:logo
cls
COLOR 0A
echo.
echo .- .:`
echo .//. `/+-
echo -/- .+/.
echo .//` ```..--------..``` `:+:
echo `:/--://++++++++++++++++//:.--.
echo `-://++++++++++++++++++++/:-`
echo `-://///++++++++++++++++++:.`
echo `:///////:://+++++++++++++:` `..``
echo `:///////. ./++++++++++:` -/+++/.
echo -///////// /++++++++/. :/++++-
echo -//////////:.``.:++++++++/` `-:/:-
echo -///////////////+++++++++/`
echo .///////////////+++++++++/
echo ////////////////++++++++.
echo ////////////////+++++++:
echo ////////////////++++++:
echo `::::::::::::::::::::::.
echo.
echo **********************************************************
echo **********************************************************
echo * *
echo * ANDROID APK LANGUAGES EXTRACTOR AND INTEGRATOR *
echo * *
echo * *
echo * BY majdinj - xda *
echo * *
echo **********************************************************
echo **********************************************************
echo.
echo.
echo How to use:
echo -----------
echo 1- Install your ROM dependencies (Only once).
echo 2- Put all same apks from different region ROM's releases in
echo "put-apk-here" folder; you can give them numbers in order
echo to not get confused; ensure no space in apk name.
echo 3- Set Current-apk for one of them, and start extracting job
echo and do the same for the rest of apk files.
echo 4- Let the apk file that you will integrate all languages in
echo to be the last apk to extract the languages from; this is
echo important to ensure the least error during compiling.
echo 5- After you extracted all languages from all apk files, and
echo being the last extracted apk is set as Current-apk, start
echo languages integrating process that will result in one apk
echo file that contains all extracted languages.
echo.
echo Note:
echo -----
echo There is an option to sign your finished apk file, this is
echo an extra step for non system apk ONLY, so you will be able
echo to install the apk on your device.
echo.
PAUSE
:restart
COLOR 0E
cls
cd "%~dp0"
echo Date: %date%
echo Time: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
echo.
echo Java Heap Memory Size: %heap% MB
echo 7za Compression Level: %comp%
echo.
echo Current-apk: %capp%
echo.
echo --------------------------------------------------------------
echo.
echo ANDROID APK LANGUAGES EXTRACTOR AND INTEGRATOR v1.05
echo.
echo --------------------------------------------------------------
echo.
echo 0 - Install Dependencies From "put-dependencies-here"
echo 1 - Set Current-apk From "put-apk-here"
echo.
echo 2 - Extract Language Folders From Current-apk File
echo 3 - Integrate Extracted Languages With Current-apk File
echo 4 - Sign Finished apk (Don't do this if it's a system apk)
echo.
echo 5 - Set Maximum Java Heap Memory Size
echo 6 - Set 7za Archiver Compression Level
echo.
echo 7 - Read Log File
echo 8 - Clean Folders
echo U - Open XDA Utility Thread Page To Check For Update
echo X - Exit
echo.
echo --------------------------------------------------------------
echo.
SET /P menu=Please make your decision: %=%
IF %menu%==0 (goto Install)
IF %menu%==1 (goto SetCapk)
IF %menu%==2 (goto Extract)
IF %menu%==3 (goto Inegrate)
IF %menu%==4 (goto Sign)
IF %menu%==5 (goto heapsize)
IF %menu%==6 (goto compression)
IF %menu%==7 (goto log)
IF %menu%==8 (goto clean)
IF %menu%==U (goto update)
IF %menu%==u (goto update)
IF %menu%==X (goto exit)
IF %menu%==x (goto exit)
::If you got here, it wasn't valid key
echo.
echo ************************************************
echo * Are you crazy.. choose something exist *
echo ************************************************
echo.
pause
goto restart
:Install
cls
cd "%~dp0"
echo Date: %date%
echo Time: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
echo.
echo Java Heap Memory Size: %heap% MB
echo App Compression Level: %comp%
echo.
echo Current-apk: %capp%
echo.
echo --------------------------------------------------------------
echo.
echo WHICH FILE DEPENDENCY DO YOU WANT TO INSTALL
echo.
echo --------------------------------------------------------------
echo.
ECHO 1 - Install framework-res.apk
ECHO 2 - Install twframework-res.apk
ECHO 3 - Install com.htc.resources.apk
ECHO 4 - Install SystemUI.apk
ECHO 5 - Install SemcGenericUxpRes.apk
ECHO 6 - Install lidroid-res.apk
ECHO.
ECHO 7 - Install Other Dependency
ECHO.
ECHO M - Go Back to the MAIN MENU
echo.
echo --------------------------------------------------------------
ECHO.
SET /P menud=Please make your decision: %=%
IF %menud%==1 (goto d1)
IF %menud%==2 (goto d2)
IF %menud%==3 (goto d3)
IF %menud%==4 (goto d4)
IF %menud%==5 (goto d5)
IF %menud%==6 (goto d6)
IF %menud%==7 (goto d7)
IF %menud%==M (goto restart)
IF %menud%==m (goto restart)
::If you got here, it wasn't valid key
echo.
echo ************************************************
echo * *
echo * Are you crazy.. choose something exist *
echo * *
echo ************************************************
echo.
pause
goto Install
:d1
IF NOT EXIST "%~dp0put-dependencies-here/framework-res.apk" (goto Pd1)
IF EXIST "%~dp0put-dependencies-here/framework-res.apk" (goto Yd1)
:Pd1
ECHO.
echo framework-res.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP1=Any key for YES or n, no for NO: %=%
IF %INPUTP1%==n (goto Install)
IF %INPUTP1%==no (goto Install)
IF %INPUTP1%==nO (goto Install)
IF %INPUTP1%==N (goto Install)
IF %INPUTP1%==No (goto Install)
IF %INPUTP1%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling framework-res.apk from device,,
adb pull system/framework/framework-res.apk "../put-dependencies-here/framework-res.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying framework-res.apk installation
goto d1
:Yd1
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/framework-res.apk
echo.
echo framework-res.apk was installed successfully..
timeout 3 > nul
goto Install
:d2
IF NOT EXIST "%~dp0put-dependencies-here/twframework-res.apk" (goto Pd2)
IF EXIST "%~dp0put-dependencies-here/twframework-res.apk" (goto Yd2)
:Pd2
ECHO.
echo twframework-res.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP2=Any key for YES or n, no for NO: %=%
IF %INPUTP2%==n (goto Install)
IF %INPUTP2%==no (goto Install)
IF %INPUTP2%==nO (goto Install)
IF %INPUTP2%==N (goto Install)
IF %INPUTP2%==No (goto Install)
IF %INPUTP2%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling twframework-res.apk from device,,
adb pull system/framework/twframework-res.apk "../put-dependencies-here/twframework-res.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying twframework-res.apk installation
goto d2
:Yd2
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/twframework-res.apk
echo.
echo twframework-res.apk was installed successfully..
timeout 3 > nul
goto Install
:d3
IF NOT EXIST "%~dp0put-dependencies-here/com.htc.resources.apk" (goto Pd3)
IF EXIST "%~dp0put-dependencies-here/com.htc.resources.apk" (goto Yd3)
:Pd3
ECHO.
echo com.htc.resources.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP3=Any key for YES or n, no for NO: %=%
IF %INPUTP3%==n (goto Install)
IF %INPUTP3%==no (goto Install)
IF %INPUTP3%==nO (goto Install)
IF %INPUTP3%==N (goto Install)
IF %INPUTP3%==No (goto Install)
IF %INPUTP3%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling com.htc.resources.apk from device,,
adb pull system/framework/com.htc.resources.apk "../put-dependencies-here/com.htc.resources.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying com.htc.resources.apk installation
goto d3
:Yd3
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/com.htc.resources.apk
echo.
echo com.htc.resources.apk was installed successfully..
timeout 3 > nul
goto Install
:d4
IF NOT EXIST "%~dp0put-dependencies-here/SystemUI.apk" (goto Pd4)
IF EXIST "%~dp0put-dependencies-here/SystemUI.apk" (goto Yd4)
:Pd4
ECHO.
echo SystemUI.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP4=Any key for YES or n, no for NO: %=%
IF %INPUTP4%==n (goto Install)
IF %INPUTP4%==no (goto Install)
IF %INPUTP4%==nO (goto Install)
IF %INPUTP4%==N (goto Install)
IF %INPUTP4%==No (goto Install)
IF %INPUTP4%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling SystemUI.apk from device,,
adb pull system/app/SystemUI.apk "../put-dependencies-here/SystemUI.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying SystemUI.apk installation
goto d4
:Yd4
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/SystemUI.apk
echo.
echo SystemUI.apk was installed successfully..
timeout 3 > nul
goto Install
:d5
IF NOT EXIST "%~dp0put-dependencies-here/SemcGenericUxpRes.apk" (goto Pd5)
IF EXIST "%~dp0put-dependencies-here/SemcGenericUxpRes.apk" (goto Yd5)
:Pd5
ECHO.
echo SemcGenericUxpRes.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP5=Any key for YES or n, no for NO: %=%
IF %INPUTP5%==n (goto Install)
IF %INPUTP5%==no (goto Install)
IF %INPUTP5%==nO (goto Install)
IF %INPUTP5%==N (goto Install)
IF %INPUTP5%==No (goto Install)
IF %INPUTP5%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling SemcGenericUxpRes.apk from device,,
adb pull system/framework/SemcGenericUxpRes.apk "../put-dependencies-here/SemcGenericUxpRes.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying SemcGenericUxpRes.apk installation
goto d5
:Yd5
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/SemcGenericUxpRes.apk
echo.
echo SemcGenericUxpRes.apk was installed successfully..
timeout 3 > nul
goto Install
:d6
IF NOT EXIST "%~dp0put-dependencies-here/lidroid-res.apk" (goto Pd6)
IF EXIST "%~dp0put-dependencies-here/lidroid-res.apk" (goto Yd6)
:Pd6
ECHO.
echo lidroid-res.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP6=Any key for YES or n, no for NO: %=%
IF %INPUTP6%==n (goto Install)
IF %INPUTP6%==no (goto Install)
IF %INPUTP6%==nO (goto Install)
IF %INPUTP6%==N (goto Install)
IF %INPUTP6%==No (goto Install)
IF %INPUTP6%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling lidroid-res.apk from device,,
adb pull system/framework/lidroid-res.apk "../put-dependencies-here/lidroid-res.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying lidroid-res.apk installation
goto d6
:Yd6
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/lidroid-res.apk
echo.
echo lidroid-res.apk was installed successfully..
timeout 3 > nul
goto Install
:d7
echo.
echo Type the dependency file name without apk extension.
set /P OTHER=Type Entery: %=%
IF NOT EXIST "%~dp0put-dependencies-here/%OTHER%.apk" (goto Pd7)
IF EXIST "%~dp0put-dependencies-here/%OTHER%.apk" (goto Yd7)
:Pd7
ECHO.
echo %OTHER%.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP7=Any key for YES or n, no for NO: %=%
IF %INPUTP7%==n (goto Install)
IF %INPUTP7%==no (goto Install)
IF %INPUTP7%==nO (goto Install)
IF %INPUTP7%==N (goto Install)
IF %INPUTP7%==No (goto Install)
IF %INPUTP7%==NO (goto Install)
echo.
echo From which system folder you want to pull it from?
set /P INPUTP8=Type any key for FRAMEWORK, or type (a) for APP folder: %=%
IF %INPUTP8%==a (goto Pd7a)
IF %INPUTP8%==A (goto Pd7a)
IF %INPUTP8%==(a) (goto Pd7a)
IF %INPUTP8%==(A) (goto Pd7a)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling %OTHER%.apk from device,,
adb pull system/framework/%OTHER%.apk "../put-dependencies-here/%OTHER%.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying %OTHER%.apk installation
goto Yd7
:Pd7a
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling %OTHER%.apk from device,,
adb pull system/app/%OTHER%.apk "../put-dependencies-here/%OTHER%.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying %OTHER%.apk installation
goto Yd7
:Yd7
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/%OTHER%.apk
echo.
echo %OTHER%.apk was installed successfully..
timeout 3 > nul
goto Install
:Extract
if %capp%==None goto noproject1
::to ensure having empty temp folder
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
echo.
echo ************************************************
echo * *
echo * Extracting Languages Process,, *
echo * *
echo ************************************************
echo.
cd "%~dp0tools"
echo A. Decompiling %capp%,,
java -Xmx%heap%M -jar apktool.jar d "../put-apk-here/%capp%" "../temp/%capp%"
IF errorlevel 1 (goto error)
timeout 2 > nul
echo.
echo B. Extracting languages values from %capp%,,
::Extracting all folders that start with value name
cd "%~dp0"
FOR /d %%a in (temp\%capp%\res\value*) Do XCOPY %%a "extracted-languages\%%a" /S /Y /I /Q > nul
xcopy "%~dp0extracted-languages\temp\%capp%\res\*" "%~dp0extracted-languages\" /S /Y /I /Q > nul
rmdir /S /Q %~dp0extracted-languages\temp > nul
timeout 2 > nul
rmdir /S /Q temp
mkdir temp
echo.
goto OpenExtract
:eek:penExtract
echo.
echo Finished %capp% languages extracting...
echo All extracted values-folder from the apk file are saved in:
echo "extracted-languages" folder.
echo.
echo Do you want to open the "extracted-languages" folder?
set /P INPUT4=Any key for YES or n, no for NO: %=%
IF %INPUT4%==n (goto :restart)
IF %INPUT4%==no (goto :restart)
IF %INPUT4%==nO (goto :restart)
IF %INPUT4%==N (goto :restart)
IF %INPUT4%==No (goto :restart)
IF %INPUT4%==NO (goto :restart)
start "" "%~dp0/extracted-languages/"
goto restart
:Inegrate
if %capp%==None goto noproject1
IF EXIST "%~dp0/finished-apk/system_%capp%" (del /Q "%~dp0\finished-apk\system_%capp%")
::to ensure having empty temp folder
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
echo.
echo ************************************************
echo * *
echo * Integrating Languages Into apk Process,, *
echo * *
echo ************************************************
echo.
cd "%~dp0tools"
echo A. Decompiling %capp%,,
java -Xmx%heap%M -jar apktool.jar d "../put-apk-here/%capp%" "../temp/%capp%"
IF errorlevel 1 (goto error)
timeout 2 > nul
echo.
echo B. Integrating extracted languages into %capp%,,,
xcopy "..\extracted-languages" "..\temp\%capp%\res" /S /Y /I /Q > nul
timeout 2 > nul
echo.
echo C. Compiling the new %capp%,,
java -Xmx%heap%M -jar apktool.jar b "../temp/%capp%" "..\temp\New_%capp%"
if errorlevel 1 (goto error)
timeout 2 > nul
echo.
echo D. Copying original signature and compressing the final apk,,,
:::::Extracting signature from original apk file:::::
7za x -o"../temp/tempOr" "../put-apk-here/%capp%" META-INF -r > nul
7za x -o"../temp/tempOr" "../put-apk-here/%capp%" AndroidManifest.xml -r > nul
:::::Extracting the new apk file for original signature integration and compression:::::
:::::1.Extracting the new apk...
7za x -o"../temp/tempAPK" "../temp/New_%capp%" -r > nul
:::::2.Copying original signature from tempOr to tempAPK...
xcopy "..\temp\tempOr" "..\temp\tempAPK" /S /Y /I /Q > nul
:::::3.Compressing the whole tempAPK folder into new2 compressed apk file...
7za a -tzip "../temp/New2_%capp%" "../temp/tempAPK/*" -mx%comp% -r > nul
if errorlevel 1 (goto error)
timeout 2 > nul
echo.
ECHO E. Zipaligning the final %capp%,,
zipalign -f 4 "%~dp0temp\New2_%capp%" "%~dp0finished-apk\system_%capp%" > nul
if errorlevel 1 (goto error)
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
echo.
echo DONE.. Your file is saved in "finished-apk" Folder as:
echo system_%capp%
goto OpenFinish
:eek:penFinish
echo.
echo Do you want to open the "finished-apk" folder?
set /P INPUT2=Any key for YES or n, no for NO: %=%
IF %INPUT2%==n (goto :restart)
IF %INPUT2%==no (goto :restart)
IF %INPUT2%==nO (goto :restart)
IF %INPUT2%==N (goto :restart)
IF %INPUT2%==No (goto :restart)
IF %INPUT2%==NO (goto :restart)
start "" "%~dp0/finished-apk/"
goto restart
:Sign
if %capp%==None goto noproject1
IF NOT EXIST "%~dp0/finished-apk/system_%capp%" (goto :SignError)
IF EXIST "%~dp0/finished-apk/signed_%capp%" (del /Q "%~dp0\finished-apk\signed_%capp%")
echo.
echo ************************************************
echo * *
echo * Signing Finished apk With New Signature. *
echo * *
echo ************************************************
echo.
cd "%~dp0tools"
echo Signing system_%capp%,,
java -Xmx%heap%M -jar signapk.jar -w testkey.x509.pem testkey.pk8 "../finished-apk/system_%capp%" "../finished-apk/signed_%capp%"
if errorlevel 1 (goto error)
echo.
echo DONE.. Your file is saved in "finished-apk" Folder as:
echo signed_%capp%
goto OpenFinish
:SetCapk
cls
echo.
echo --------------------------------------------------------------
echo Please select a file from the list bellow to
echo be set as Current-apk in "put-apk-here" folder
echo --------------------------------------------------------------
echo.
set /A count=0
FOR %%F IN (put-apk-here/*.apk) DO (
set /A count+=1
set a!count!=%%F
if /I !count! LEQ 9 (echo ^- !count! - %%F )
if /I !count! GTR 9 (echo ^- !count! - %%F )
)
echo.
echo.
echo --------------------------------------------------------------
echo (Any letter or other number to return back to MAIN MENU)
echo --------------------------------------------------------------
ECHO.
set /P INPUT3=Please Enter The File Number: %=%
if /I %INPUT3% GTR !count! (goto non1)
if /I %INPUT3% LSS 1 (goto non1)
set capp=!a%INPUT3%!
set jar=0
set ext=jar
IF "!capp:%ext%=!" NEQ "%capp%" set jar=1
goto restart
:non1
set capp=None
goto restart
:clean
cls
cd "%~dp0"
echo Date: %date%
echo Time: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
echo.
echo Java Heap Memory Size: %heap% MB
echo App Compression Level: %comp%
echo.
echo Current-apk: %capp%
echo.
echo --------------------------------------------------------------
echo.
echo CLEANING MENU
echo.
echo --------------------------------------------------------------
echo.
echo 1 - Clean "put-apk-here" Folder
echo 2 - Clean "put-dependencies-here" Folder
echo 3 - Clean "extracted-languages" Folder
echo 4 - Clean "finished-apk" Folder
echo 5 - Clean "temp" Folder
echo.
echo 6 - Clean All Working Folders
echo.
echo M - Go Back To The MAIN MENU
echo.
echo.
echo --------------------------------------------------------------
echo.
SET /P menuc=Please make your decision: %=%
IF %menuc%==1 (goto pfhf)
IF %menuc%==2 (goto fd)
IF %menuc%==3 (goto el)
IF %menuc%==4 (goto ff)
IF %menuc%==5 (goto tf)
IF %menuc%==6 (goto allf)
IF %menuc%==M (goto restart)
IF %menuc%==m (goto restart)
[user=228282]@Rem[/user] If you got here, it wasn't valid key
echo.
echo ************************************************
echo * *
echo * Are you crazy.. choose something exist *
echo * *
echo ************************************************
echo.
pause
goto clean
:pfhf
rmdir /S /Q put-apk-here
mkdir put-apk-here
echo.
echo "put-apk-here" folder is cleaned.
echo.
pause
set capp=None
goto clean
:fd
rmdir /S /Q put-dependencies-here
mkdir put-dependencies-here
echo.
echo "put-dependencies-here" folder is cleaned.
echo.
pause
goto clean
:el
rmdir /S /Q extracted-languages
mkdir extracted-languages
echo.
echo "extracted-languages" folder is cleaned.
echo.
pause
goto clean
:ff
rmdir /S /Q finished-apk
mkdir finished-apk
echo.
echo "finished-apk" folder is cleaned.
echo.
pause
goto clean
:tf
rmdir /S /Q temp
mkdir temp
echo.
echo "temp" folder is cleaned.
echo.
pause
goto clean
:allf
rmdir /S /Q put-apk-here
rmdir /S /Q put-dependencies-here
rmdir /S /Q extracted-languages
rmdir /S /Q finished-apk
rmdir /S /Q temp
mkdir put-apk-here
mkdir put-dependencies-here
mkdir extracted-languages
mkdir finished-apk
mkdir temp
echo.
echo All working folders are cleaned.
echo.
pause
set capp=None
goto clean
:heapsize
echo.
echo Enter maximum java heap size in megabytes (16-1400)
set /P INPUTH=(default 1024): %=%
set heap=%INPUTH%
if "%INPUTH%"=="" (set heap=1024)
if /I %INPUTH% GTR 1400 (set heap=1400)
if /I %INPUTH% LSS 16 (set heap=16)
goto restart
:compression
echo.
echo Enter Compression Level For 7za Archiver (0-9)
set /P INPUTCO=(default 9): %=%
set comp=%INPUTCO%
if "%INPUTCO%"=="" (set comp=9)
if /I %INPUTCO% GTR 9 (set comp=9)
if /I %INPUTCO% LSS 0 (set comp=0)
goto restart
:noproject1
echo.
echo *************
echo * ERROR *
echo *************
echo.
echo Please Set Current-apk. (Option 1)
echo.
echo.
PAUSE
goto restart
:SignError
echo.
echo *************
echo * ERROR *
echo *************
echo.
echo There is no system_%capp% file in "finished-apk" folder
echo.
echo.
PAUSE
goto restart
:error
echo.
echo "An Error Occured, Check The log File (option 7)"
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
echo.
PAUSE
goto restart
:err_adb
echo.
adb kill-server
adb kill-server
ECHO "An Error Occured, Please Check The Log (option 7)"
echo.
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
PAUSE
goto restart
:errjava
COLOR 0C
CLS
echo.
echo.
echo.
echo **************************************************
echo **************************************************
echo ** **
ECHO ** Java was not found,,,, **
echo ** You will not be able to use this tool, **
echo ** until you install Java environment **
echo ** **
echo **************************************************
echo **************************************************
echo.
echo.
echo.
PAUSE
goto logo
:log
cd "%~dp0/tools"
Start "[APK LANGUAGES EXTRACTOR TOOL - majdinj - xda] READING LOG FILE FROM" logscript 1
goto restart
:update
echo.
echo Opening XDA Utility Thread Page,,, Please Wait,,,
timeout 2 > nul
start http://forum.xda-developers.com/showthread.php?p=43669667#post43669667
goto restart
:exit
echo.
echo.
echo.
echo.
echo Bye Bye, see ya later :)
echo.
echo.
echo.
timeout 3
EXIT
Nice tool, I'll test it for a next release. ^_^
It seems there is error code in the script that throw some error messages in the utility,,
I will look at it very soon,,
At work on the moment,,, but within hours hopefully, the fix will be online
New update added:
@ 19/July/2013 (v1.05) change-log:
- Fixed error message during language integration "The process cannot access the file because it is being used by another process".
- Fixed compression function. Now the whole final apk file is compressed by level specified, instead of signature only (my bad!!).
- Fixed open "finished-apk" folder delay after language integrating process.
- Deleting existing signed file apk of same name before signing (no more overlapping).
- New option added in the main menu to link the utility with this thread page (you can check update anytime now).
so so so..thank you so much, i need this tool at a long time..
sir, in my rom nothing language.xml file.
how to fixed that?
my device SGY Duos.
Thanks.
wawan999 said:
sir, in my rom nothing language.xml file.
how to fixed that?
my device SGY Duos.
Thanks.
Click to expand...
Click to collapse
You need to search the corresponding xml that contains all languages in system\csc folder.. It could be named with different name..!!
Can this use for MIUI V5 to add multi-language support?
thanks
Ruling said:
Can this use for MIUI V5 to add multi-language support?
thanks
Click to expand...
Click to collapse
Why not..!!! All what this tool did, is just combine all languages values of the specific same apk files into one multi-languages apk file of that specific type.
Very Helpful .Thanks mate for this :thumbup: .
A lil' suggestion ..please Include post #3 in Hide tags ...its soo big
majdinj said:
Why not..!!! All what this tool did, is just combine all languages values of the specific same apk files into one multi-languages apk file of that specific type.
Click to expand...
Click to collapse
Thank you
thank you so much, i need this tool at a long time.
thank pro. how to edit or sing files sec_csc.zip.
:good: great tool
kermage said:
:good: great tool
Click to expand...
Click to collapse
Can this tool sign sec_csc.zip to flash through the stock 3e? Thanks Pro
Hi, how can i export language.xml from S5 (international) add import to USA S5 ?
because Samsung removed my languages support on the new updates, the US variants used to languages-less.
http://forum.xda-developers.com/galaxy-s5/help/languages-missing-s5-t2833249
majdinj said:
<<In this post, we will concentrate on making the added languages visible and usable in your cooked ROM. Also we will learn how to add different CSC code regions in the cooked ROM>>
How to add languages to language display and language input:
1. Navigate to system\csc\common\system\csc folder and open language.xml file. Here we will concentrate in this section:
Code:
<LanguageSet>
[B][COLOR="Blue"]<Display>[/COLOR][/B] [B][COLOR="Green"]<!-- This section is for displayed languages[/COLOR][/B]
en_GB;en_US;fr_FR;
ar_AE;fa_FA;ur_PK;
</Display>
[B][COLOR="Blue"]<Input>[/COLOR][/B] [B][COLOR="Green"]<!-- This section is for input languages[/COLOR][/B]
<SupportList>
en_GB;en_US;fr;ar;fa;ur;
</SupportList>
<EnableList>
</EnableList>
</Input>
</LanguageSet>
for each section you can add iso code language for each region. Here is the code again after applying iso code languages:
Code:
<LanguageSet>
<Display>
en_GB;ar_AE;az_AZ;bg_BG;ca_ES;cs_CZ;da_DK;de_AT;de_CH;de_DE;
el_GR;en_AU;en_IE;en_NZ;en_PH;en_US;en_ZA;es_ES;es_US;et_EE;
eu_ES;f_FI;fa_FA;fr_CH;fr_FR;ga_IE;gl_ES;hr_HR;hu_HU;hy_AM;
in_ID;is_IS;it_IT;ka_GE;kk_KZ;ko_KR;lt_LT;lv_LV;mk_MK;ms_MY;
nb_NO;nl_BE;nl_NL;pl_PL;pt_BR;pt_PT;ro_RO;ru_RU;sk_SK;sl_SI;
sr_RS;sv_SE;th_TH;tr_TR;ur_PK;uk_UA;uz_UZ;vi_VN;zh_CN;zh_HK;
zh_TW;
</Display>
<Input>
<SupportList>
en_GB;ar;az;bg;bn;ca;cs;da;de;el;
en_US;es;et;eu;fa;fi;fr;gl;gu;hi;
hr;hu;hy;id;is;it;ka;kk;kn;ko;
lt;lv;ml;ms;mr;nb;nl;pa;pl;pt;
ro;ru;sk;sl;sr;sv;ta;te;th;tr;
uk;ur;vi;zh_CN;
</SupportList>
<EnableList>
</EnableList>
</Input>
</LanguageSet>
of course after extracting a lot of ROMs from specific regions, you can just add their iso code language in your cooked ROM language.xml after having the iso codes from their language.xml files
2. Now copy this modified language.xml and paste it on system\csc directory
3. Now to display language name in your device, you need to decompile ResourceManager.apk and navigate to res\values folder and open strings.xml and add new languages resources strings there in this form:
Code:
<string name="vo_rm_authority">com.visionobjects.resourcemanager</string>
<string name="[B][COLOR="Red"]en_GB[/COLOR][/B]">[B][COLOR="Blue"]English(UK)[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]en_US[/COLOR][/B]">[B][COLOR="Blue"]English(US)[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]az[/COLOR][/B]">[B][COLOR="Blue"]Azərbaycan[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]ca[/COLOR][/B]">[B][COLOR="Blue"]Català[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]cs[/COLOR][/B]">[B][COLOR="Blue"]Čeština[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]da[/COLOR][/B]">[B][COLOR="Blue"]Dansk[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]de[/COLOR][/B]">[B][COLOR="Blue"]Deutsch[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]et[/COLOR][/B]">[B][COLOR="Blue"]Eesti[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]es[/COLOR][/B]">[B][COLOR="Blue"]Español[/COLOR][/B]</string>
..
..
[B][COLOR="Green"]and so on[/COLOR][/B]
Here the red texts are regional iso codes for the added language, and the blue texts are the displayed language name in your device (you can decompile ResourceManager.apk from different ROMs' regions in order to have the iso codes and the corresponding languages strings).
4. Now you need to add input database for different languages. After extracting different ROMs' regions, copy all the content of system\T9DB and paste it in same directory of the ROM that you will make it support different languages.
5. Now you will need to integrate languages data base; after extracting different ROMs' regions, copy all the content of system\hdic folder and paste it in same directory of the ROM that you will make it support different languages.
How to set default language in initial setup wizard:
Go to system\csc folder and open customer.xml and edit this section:
Code:
<Phone>
<DefLanguage>[B][COLOR="Blue"]ar_AE[/COLOR][/B]</DefLanguage>
<DefLanguageNoSIM>[B][COLOR="Blue"]ar_AE[/COLOR][/B]</DefLanguageNoSIM>
<DateTimeFormat>
<DateFormat>ddmmyyyy</DateFormat>
</DateTimeFormat>
<VisiblePassword>off</VisiblePassword>
</Phone>
Just change the blue colored iso code and substitute it with your favorite one from language.xml display section
CSC codes:
How to set default csc code:
Go to system\csc\%yourCSCfolder%\system\csc folder and copy all its content (usually contents.db, customer.xml, others.xml, and sales_code.dat) and paste it on system\csc directory.
Alternatively, you can edit the files in system\csc folder that includes:
customer.xml
Code:
<SalesCode>[B][COLOR="Blue"]KSA[/COLOR][/B]</SalesCode>
change it to your csc iso code (that is the csc folder name in system\csc folder).
language.xml:
Code:
<SalesCode>[B][COLOR="Blue"]KSA[/COLOR][/B]</SalesCode>
the same as change in customer.xml
sales_code.dat
Code:
[B][COLOR="Blue"]KSA[/COLOR][/B]
the same as change in customer.xml
How to add extra CSC codes:
After extracting all CSC folders from different ROMs region, first copy and paste them in system\csc folder then you need to go to system directory and open SW_Configuration.xml and add all CSC folders you just paste:
Code:
<NbCustomer>[B][COLOR="Blue"]67[/COLOR][/B]</NbCustomer> [B][COLOR="Green"]<!-- Here enter how many csc code folders you have in system\csc[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ABS[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]AFG[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]AFR[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |--- Here add CSC folders[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ALO[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ARB[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
..
..
[B][COLOR="Green"]and so on[/COLOR][/B]
And now you are ready to create your multi-languages and multi-csc ROM,,
Click to expand...
Click to collapse
salam alaikom
but lanuage.xml not found in my phone
even i show hiden files
hi @majdinj can you put new apktool for this tool or tell my how to update? i put apktool 2.2.2 in tool dir but get error when decompiling?
Before we start :
all credit goes to the following users for their amazing work and guides : olddroid, Sudeep, Eduardo Alonso and mrmazak
Honor 7x Knowledge base :
A – Unlocking your bootloader and getting ready to flash custom roms :
Alright we got 2 states in order to do this :
1- if your phone is fully working (Not soft bricked) :
You need the following things:
Device model:
Serial number:
IMEI:
Product ID - dialing *#*#1357946#*#*.
2 – If your phone is soft bricked and you only know your Imei number you can use this site to give you full info :
https://imei24.com/imei_check/Huawei/
Lastly , Submit this info in the google form and you should get your code within a day or less
https://docs.google.com/forms/d/e/1...YnBcAxAbz9SAVxPTFqMh9g/viewform?usp=send_form
B – Unbricking your phone :
1 – Knowing your model number:
Below are the model numbers for 7X
BND-L21C432 (Europe), BND-L21C185 (Middle East), BND-AL10C675 (India), BND-AL (TL) 10C00 (China), BND-L21C10 (Russia)
[–COLOR="lime"] Finding the right update package through firmware finder :
[/COLOR]1 – Visit the link http://pro-teammt.ru/firmware-database/?firmware_model=BND&firmware_page=1
2 – Find the right model as listed above (For nougat update will be called the same as the model number provided in Step 1 in section B)
3 – Make sure the update package type is Full-Ota
4 – since oreo , they don’t list the region, the best way to know if the update is compatible is by using this method : click on the file list , the second file would have some codes that I will explain
update_full_BND-l21_xxx.zip (the first part changes depends on the model)
If the code was _eu = it’s for the Eu version
If the code was _usa= American version
If the code was _in= India
Mefanf (or something like that ) = middle east, you get the idea by now
C- Flashing the update zips :
Alright this is the part where most users have errors so let’s try to make it simple
1 - For nougat with update zips
You need 5 main things in order to do that and they are :
BND-RECOVERY-NoCheck.img <download here
update.zip < from firmware finder
update_data_full_public.zip < from firmware finder
update_full_xxxxx.zip <from firmware founder
twrp for nougat < download here
4 gb sd
How to :
1 – Flash the nougat twrp
2 – copy update.zip , update_data_full_public_zip , update_full_xxxx (name changes depending on region and model) and BND-Recovery-NoCheck.img
3 – boot into twrp , plugin the phone via usb , open a command prompt on your pc
4 – type adb shell , press enter then copy paste these commands :
dd if=/external_sd/BND-RECOVERY-NoCheck.img of=/dev/block/bootdevice/by-name/recovery
dd if=/external_sd/BND-RECOVERY-NoCheck.img of=/dev/block/bootdevice/by-name/recovery2
echo --update_package=/sdcard/update.zip > /cache/recovery/command
echo --update_package=/sdcard/update_data_full_public.zip >> /cache/recovery/command
echo --update_package=/sdcard/update_full_xxxxx.zip >> /cache/recovery/command
reboot recovery
after that your phone will reboot and it will start updating
note : if adb shell doesn’t work , go to twrp >> advanced , terminal and type them manually
note: when you paste the echo commands they don’t show any output , that’s perfectly normal
2 – For nougat without update zips:
You also need :
BND-ReocveryNocheck.img
Twrp for Nougat
Sd card 4gb
Boot.img
Cust.img
System.img
Vendor.img
Version.img
Product.img
How to :
1 – Copy Product.img, Vendor.img, Version.img , cust.img to the root of your sd card
2 – copy paste the following commands via adb shell or the terminal in twrp
dd if=/external_sd/product.img of=/dev/block/mmcblk0p48
dd if=/external_sd/vendor.img of=/dev/block/mmcblk0p47
dd if=/external_sd/version.img of=/dev/block/mmcblk0p46
dd if=/external_sd/cust.img of=/dev/block/mmcblk0p45
3 – reboot to bootloader , flash boot and system images and everything should work fine
For Oreo with zip it’s the same steps like Nougat with zips but you just need a different recovery called
RecoveryNoCheckOreoHi6250 and twrp ramdisk
note : to flash twrp on oreo use this command
fastboot flash recovery_ramdisk imgnamehere.img
they can be found here
I like to try and Turn these monotonous repetitive things into tools.Mainly because one simple typo in the process can make it difficult to repair.
So I am in the process of making such a tool.
As a starting point I have made simple coding to do the recovery install part.
For now there are two batch programs , one for nougat , and one for oreo.
I am working toward some crafty line of code that can determine what build is on your devices first and according to the result choose which of the two batches to run.
In the meantime here are the two recovery switching batches. with recovery images included that have been copied from the xda forum.
Code:
@echo off
title Lazy Recovery Replace Oreo
adb shell getprop ro.build.version.emui > %~dp0\version-info.txt
for /f %%i in ('FINDSTR "EmotionUI_" %~dp0\version-info.txt') do set emui=%%i
echo %emui%
set str=%emui:~10%
echo.%str%
pause
if %str% lss 5.3 (goto nougat
)else (
echo ok to continue)
adb reboot bootloader
echo Wait Here untill fastboot mode Loads On Phone
SET PATH=%PATH%;"%~dp0\files\oreo"
pause
fastboot oem get-build-number 2> %~dp0\build-info.txt
for /f "tokens=2" %%i in ('findstr "^(bootloader)" "%~dp0\build-info.txt"') do set Device=%%i
for /f "tokens=3" %%i in ('findstr "^(bootloader)" "%~dp0\build-info.txt"') do set Build=%%i
echo Your Current Device is = %Device% %Build%
pause
:MAIN
cls
echo Choose what you need to work on.
echo(
echo %Device% %Build%
echo ][************************************][
echo ][ 1. complete_twrp_ramdisk ][
echo ][************************************][
echo ][ 2. Oreo Stock from beta ][
echo ][************************************][
echo ][ 3. twrp_p10_lite_0.3 Encryt works ][
echo ][************************************][
echo ][ 4. Oreo No-Check ][
echo ][************************************][
echo ][ 5. Local Image ][
echo ][************************************][
echo ][ 6. Cancel Exit and Reboot ][
echo ][************************************][
echo(
echo For performing Update simplest option is choose #1
set /p env=Type your option [1,2,3,4,5,6] then press ENTER: || set env="0"
if /I %env%==1 set recovery=complete_twrp_ramdisk.img && goto flash
if /I %env%==2 set recovery=RECOVERY_RAMDIS.img && goto flash
if /I %env%==3 set recovery=twrp_p10_lite_0.3.img && goto flash
if /I %env%==4 set recovery=RecoveryNoCheckOreoHi6250.img && goto flash
if /I %env%==5 call scripts\oreo\oreo_local_image_select.bat || goto end
if /I %env%==6 fastboot reboot && goto :eof
echo(
echo %env% is not a valid option. Please try again!
PING -n 3 127.0.0.1>nul
goto MAIN
:flash
echo THE FOLLOWING FILE HAS BEEN SELECTED
echo %recovery%
echo Continue IF it is correct, Else close window to cancel
pause
fastboot flash recovery_ramdisk %recovery%
:end
echo RECOVERY SHOULD NOW BE FLASHED
echo GET READY TO PULL USB PLUG OUT AND HOLD VOLUME UP
echo RIGHT AFTER YOU PRESS BUTTON TO CONTINUE
pause
fastboot reboot
goto :eof
exit
:nougat
echo You are On NOUGAT DO NOT USE THIS
pause
exit
Code:
@echo off
title Lazy Recovery Replace Nougat
adb shell getprop ro.build.version.emui > %~dp0\version-info.txt
for /f %%i in ('FINDSTR "EmotionUI_" %~dp0\version-info.txt') do set emui=%%i
echo %emui%
set str=%emui:~10%
echo.%str%
pause
if %str% gtr 5.2 (goto oreo
)else (
echo ok to continue)
adb reboot bootloader
echo Wait Here untill fastboot mode Loads On Phone
SET PATH=%PATH%;"%~dp0\files\oreo"
pause
fastboot oem get-build-number 2> %~dp0\build-info.txt
for /f "tokens=2" %%i in ('findstr "^(bootloader)" "%~dp0\build-info.txt"') do set Device=%%i
for /f "tokens=3" %%i in ('findstr "^(bootloader)" "%~dp0\build-info.txt"') do set Build=%%i
echo Your Current Device is = %Device% %Build%
pause
:MAIN
cls
echo Choose what you need to work on.
echo(
echo %Device% %Build%
echo ][************************************][
echo ][ 1. twrp-honor ][
echo ][************************************][
echo ][ 2. Stock Recovery ][
echo ][************************************][
echo ][ 3. Stock Recovery 2 ][
echo ][************************************][
echo ][ 4. BND-NO-CHECK ][
echo ][************************************][
echo ][ 5. Other file from your PC ][
echo ][************************************][
echo ][ 6. Cancel Exit and Reboot ][
echo ][************************************][
echo(
set /p env=Type your option [1,2,3,4,5,6] then press ENTER: || set env="0"
if /I %env%==1 set recovery=twrp-honor.img && goto flash
if /I %env%==2 set recovery=recovery.img && goto flash
if /I %env%==3 set recovery=recovery2.img && goto flash2
if /I %env%==4 set recovery=BND-RECOVERY-NoCheck.img && goto flash
if /I %env%==5 call scripts\nougat\nougat_recovery_file_flash.bat || goto end
if /I %env%==6 fastboot reboot && goto :eof
echo(
echo %env% is not a valid option. Please try again!
PING -n 3 127.0.0.1>nul
goto MAIN
:flash
echo THE FOLLOWING FILE HAS BEEN SELECTED
echo %recovery%
echo Continue IF it is correct, Else close window to cancel
pause
fastboot flash recovery %recovery%
goto end
:flash2
echo THE FOLLOWING FILE HAS BEEN SELECTED
echo %recovery%
echo Continue IF it is correct, Else close window to cancel
fastboot flash recovery2 %recovery%
:end
echo RECOVERY SHOULD NOW BE FLASHED
echo GET READY TO PULL USB PLUG OUT AND HOLD VOLUME UP
echo RIGHT AFTER YOU PRESS BUTTON TO CONTINUE
pause
fastboot reboot
goto :eof
exit
:oreo
echo You are On OREO DO NOT USE THIS
pause
exit
I have the launcher batch ready, it will detect the emui version with getprop. And call the appropriate switcher batch.
Code:
@echo off
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
title Lazy Recovery Auto Launcher
echo Waiting For device to be recognized by ADB
adb wait-for-device
adb shell getprop ro.build.version.emui > %~dp0\version-info.txt
for /f %%i in ('FINDSTR "EmotionUI_" %~dp0\version-info.txt') do set emui=%%i
echo %emui%
set str=%emui:~10%
echo.%str%
pause
if %str% equ 8 call scripts\oreo\Oreo_lazy_Recovery.bat
if %str% equ 8.1 call scripts\oreo\Oreo_lazy_Recovery.bat
if %str% equ 5 call scripts\nougat\Nougat_lazy_Recovery.bat
if %str% equ 5.1 call scripts\nougat\Nougat_lazy_Recovery.bat
pause
exit
Updated 5-21
Tool Download
.
Hi!
I manged to easly add any shortcut to right click window options. Just do a right click in a empty space on desktop to show the window with your shotcuts.
I let the code here, just save as bat.
Code:
@echo off & @echo. & @echo.
set /p app=[44m Add app name here: [0m & @echo.
@echo [44m Add app path here with \\ between directorys and file as example: [0m
set /p path=[44m C:\\Windows\\regedit.exe to add regedit : [0m & @echo.
@echo Windows Registry Editor Version 5.00 > "add%app%torightclickmenu.reg"
@echo. >> "add%app%torightclickmenu.reg"
@echo [HKEY_CLASSES_ROOT\Directory\Background\shell\%app%] >> "add%app%torightclickmenu.reg"
@echo @="Start %app% " >> "add%app%torightclickmenu.reg"
@echo. >> "add%app%torightclickmenu.reg"
@echo [HKEY_CLASSES_ROOT\Directory\Background\shell\%app%\command] >> "add%app%torightclickmenu.reg"
@echo @="%path%" >> "add%app%torightclickmenu.reg"
@echo. >> "add%app%torightclickmenu.reg"
@echo Building reg file...
Call "add%app%torightclickmenu.reg"
@echo Done!
pause
exit
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I hope this help you.
Updated.
Fix error with names with spaces between.
Hi again!
I create a bat to easly delete the shortcuts you add to right click window options.
This the code:
Code:
@echo off & @echo. & @echo.
:: Checking for Administrative Privileges
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
:: If got error flag do not have Administrative Privileges
if '%errorlevel%' NEQ '0' (
echo [41m ::Requesting administrative privileges...[0m & TIMEOUT /T 2 /NOBREAK > nul
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
CD /d "%~dp0"
@echo.
@echo [44m Insert key root to delete here as example: Deleting [31mteste[0m[44m key [0m
@echo [44m HKEY_CLASSES_ROOT\Directory\Background\shell\[31mteste [0m
@echo.
set /p key=[44m Insert key root here: [0m
reg delete "%key%"
@echo. & @echo Done!
pause
exit
Save as bat file.
I hope this helps you.
Hi!
I create a bat to execute cmd as administrator in any window, just add it to right click window and do right click in any window/directory to call it!
This is the code:
Code:
@echo off & @echo. & @echo.
:: Checking for Administrative Privileges
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
:: If got error flag do not have Administrative Privileges
if '%errorlevel%' NEQ '0' (
echo [41m ::Requesting administrative privileges...[0m & TIMEOUT /T 2 /NOBREAK > nul
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
CD /d "%~dp0"
call cmd.exe
exit
Just save as bat, create a folder with bat name, past bat inside then paste it in c:\programs ( as example), add to right click window! Now you can call cmd with right click window in any place as adminsitrator.