平方X 发表于 2017-9-3 12:18:41

AndroidStudio翻译(6)-Tip of the Day每日提示中文翻译

# AndroidStudio翻译(6)-Tip of the Day每日提示中文翻译
>本文由平方X发表于平方X网,转载请注明出处。[http://blog.pingfangx.com/2358.html](http://blog.pingfangx.com/2358.html)

# 0x01 准备待翻译文件
位于resources.jar,tips/

# 0x02 进行翻译
# 0x03 翻译后处理
## 3.1 删除mate
OmegaT自动添加了编码,但是在AndroidStudio中却无法显示了,将其删除。
```
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
```
## 3.2 替换\&amp;为&
也是OmegaT自动转换的,替换回去

## 3.3 添加标题和上一页、下一页
方便直接阅读,不依赖于AndroidStudio

## 3.4 解析快捷键
```
result = re.sub(r'&shortcut:(\w+);', Tips.replace_shortcut, result)
```

## 3.5 解析变量
```
result = re.sub(r'&(?!lt|gt|nbsp)(\w+);', Tips.replace_variable, result)
```

## 排序
提示文件来自resources.jar→\META-INF\IdeTipsAndTricks.xml
翻译完成后,tips里面还有1条,来自resources.jar→\META-INF\XmlPlugin.xml
```
    <tipAndTrick file="TagNameCompletion.html"/>
```
加上这条,依然还有kotlin的,应该是以插件的形式。
## 标题
标题就取上面顺序中的文件名,翻译一下。
*将驼峰分割为单词
```
result = re.sub('+', lambda m: m.group().lower() + ' ', word).rstrip()
```
但是CtrlShiftIForLookup中的IFor和moveFileToChangelist中的move无法正常匹配。


# 相关
## 相关源码
(https://github.com/pingfangx/PythonX/blob/feature-android_studio_translator/ToolsX/android_studio_translator/tips/tips.py)

## 结果文件
(https://pingfangx.github.io/android_studio/tips/index.html)

## 序列文章
* (http://blog.pingfangx.com/2353.html)
* (http://blog.pingfangx.com/2354.html)
* (http://blog.pingfangx.com/2355.html)
* (http://blog.pingfangx.com/2356.html)
* (http://blog.pingfangx.com/2357.html)
* (http://blog.pingfangx.com/2358.html)


页: [1]
查看完整版本: AndroidStudio翻译(6)-Tip of the Day每日提示中文翻译