一. 主要是针对recovery汉化,主要汉化对象是界面显示为中文。
二. 基于中文的汉化,有两种方式,一种是基于GB2312的编码格式汉化,另外一种是基于unicode编码格式汉化。下面介绍unicode中文汉化。
三. 汉化主要需要修改四个文件,汉化步骤:
3.1 default_device.cpp修改,主界面汉化
增加中文的界面,但是由于是unicode编码,所以在source insight里面显示乱码:
这些看似乱码,我们可以这样获取,桌面新建txt文档,使用notepad++工具打开, 选择格式,以UTF-8 无BOM格式编码,里面写入需要显示的汉字,然后保存,然后把新建的txt使用source insight打开即可。
3.2 unicode的中文字库获取,网上可以下载, eg:fontcn30_18x48.h
3.3 针对unicode的解析源文件graphics_cn.c
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include