cordova图片选择组件汉化

2017-07-13  本文已影响0人  W北落师门W

本篇文章推荐的图片选择组件有两个cordova-plugin-cameracordova-image-picker

  1. 首先介绍cordova-plugin-camera,该插件能实现拍照和相册选择两种功能,Android下能正常使用,不需要汉化,IOS下汉化如图
plist修改

XCode打开项目,在plist下添加图中箭头所指的联想,再添加Item1中的Chinese即可,比较好实现

2.第二种图片选择插件是cordova-image-picker,它能够实现从相册选择图片的功能,它的汉化就比较麻烦,第一步是如图一所示,然后找到下图所示的目录

cordova-image-picker国际化文件夹

可以复制已有的文件夹,复制一个,命名为zh.lproj,如果选择了简体中文,则文件夹命名为zh-Hans.lproj,文件夹内的文件内容修改为

/* Cancel */
"picker.navigation.cancel-button" = "取消";

/* Done */
"picker.navigation.done-button" = "完成";

/* Navigation bar default title */
"picker.navigation.title" = "选择相册";

/* %@ Items Selected */
"picker.selection.multiple-items" = "已选择%@个项目";

/* %@ Photos Selected */
"picker.selection.multiple-photos" = "已选择%@张照片";

/* %@ Videos Selected */
"picker.selection.multiple-videos" = "已选择%@个视频";

/* 1 Photo Selected */
"picker.selection.single-photo" = "已选择1张照片";

/* 1 Video Selected */
"picker.selection.single-video" = "已选择1个视频";

/* All photos */
"picker.table.all-photos-label" = "相机胶卷";

/* Smart Albums */
"picker.table.smart-albums-header" = "智能相册";

/* Albums */
"picker.table.user-albums-header" = "相册";

/* Confirmation of single selection alert title */
"picker.confirm.title" = "是否确定?";

/* Confirmation of single selection alert message */
"picker.confirm.message" = "是否要选择您所点击的图片?";

/* Action (button) deny/no/refuse */
"picker.action.no" = "取消";

/* Action (button) agree/yes/approve */
"picker.action.yes" = "确定";

即可。如果还是不行,可尝试见en文件夹下的文件内容改为上述内容试试。

以上是项目中遇到的问题及一些解决办法。

上一篇下一篇

猜你喜欢

热点阅读