资产文件的本地化 [英] localization of assets files

查看:127
本文介绍了资产文件的本地化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的资产文件夹一些html文件。我该如何定位呢?是我唯一的选择把一些硬code挑根据语言环境的正确的文件?

I have several html files in assets folder. How can I localize them? Is my only option to put some hardcode to pick the right file based on locale?

推荐答案

这是不直接,但这里的支持是我做了什么......

This isn't supported directly but here is what I have done...

分隔的文件转换成按国家code组(像你会做什么正常的资源文件),然后创建你的每一个名为类似preFIX本地化string.xml文件的本地化的字符串(其中,preFIX将是en表示英语为例)。

Separate your files into groups by country code (like what you would do for normal resource files) and then create a localized string in each of your localized string.xml files called something like "prefix" (where prefix would be "en" for English for example).

当你建立你的资产的文件名的简单使用类似的getString(preFIX)+于是 - +<名称-的资产 - >

Then when you build your asset filenames simple use something like getString("prefix") + "-" + "<name-of-asset->.

目前至少的某种变体上面应该为你工作。

At least some variation of the above should work for you.

这篇关于资产文件的本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆