标准后备语言进行翻译

时间:2019-01-29 01:45:40

标签: translation gettext culture

我有一个应用程序可以翻译成约10种语言。当然,我们会尝试使翻译保持最新状态,但是它从来都不是完美的,很多都是社区的贡献,而且我们经常发布仅处于(不)完整程度(例如80%)的翻译版本。 >

因此,缺少翻译是生活中的事实。默认情况下,gettext会在无法提供翻译时退回到源语言(英语)。

我可以翻译pt_PT,pt_BR和es_ES。在那种情况下,我认为最好还是退缩

  • 从pt_PT到pt_BR到es_ES,然后只有英语;
  • 从pt_BR到pt_PT到es_ES,然后只有英语;
  • 从es_ES到pt_BR到pt_PT,然后只有英语;
  • 从任何其他语言到英语。

我的问题是

  • 这在文化上合适吗?
  • 这是否比仅仅回到英语(现在)更糟?”
  • 是否有像这样的后备区域设置的标准列表? “最坏的情况,但比英语要好”

我看到gettext: How to fall back to the base language?谈论回退的捷克语->斯洛伐克语->英语,Gettext fallbacks don't work with untranslated strings谈论回退的西班牙语->英语->俄语。

1 个答案:

答案 0 :(得分:0)

确切答案取决于您检索译文的准确程度。

如果您使用的是GNU gettext兼容框架,请设置环境变量public class FeaturedlistAdapter extends RecyclerView.Adapter<FeaturedlistAdapter.FeaturedView> { private Context context; private List<Featured_data> featured_data; public FeaturedlistAdapter(Context context, List<Featured_data> featured_data,MyAdapterListener myAdapterListener) { this.context=context; this.featured_data=featured_data; this.onclickListener=myAdapterListener; } @NonNull @Override public FeaturedView onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(context).inflate(R.layout.list_allbrands, viewGroup, false); return new FeaturedView(view); } @Override public void onBindViewHolder(@NonNull FeaturedView featuredView, int i) { String price = featured_data.get(i).getProductPrice(); String name = featured_data.get(i).getProductName(); String quantity = featured_data.get(i).getProductQty(); featuredView.getTxt_brandname().setText(featured_data.get(i).getProductName()); String wishlist=featured_data.get(i).getWishlist(); Picasso.get().load(HomeConstants.BASE_URL + featured_data.get(i).getProductImage()).placeholder(R.drawable.whitebackground).into(featuredView.img_brand); if (price != null && !price.equals("")) { String total_price = price + " Rs"; featuredView.getTxt_brand_price().setText(total_price); } if (quantity != null && !quantity.equals("")) { String total_quantity = quantity + " Items"; featuredView.getTxt_brand_item().setText(total_quantity); } if(wishlist!=null) { if(wishlist.equals("0")) { featuredView.img_wishlist.setColorFilter(Color.argb(255, 211, 211, 211)); featuredView.txt_count.setText("0"); } else if(wishlist.equals("1")) { featuredView.img_wishlist.setColorFilter(Color.argb(255,255,0,0)); featuredView.txt_count.setText("1"); } } else { featuredView.img_wishlist.setColorFilter(Color.argb(255, 211, 211, 211)); featuredView.txt_count.setText("0"); } } @Override public int getItemCount() { return featured_data.size(); } @Override public long getItemId(int position) { return super.getItemId(position); } @Override public int getItemViewType(int position) { return super.getItemViewType(position); } class FeaturedView extends RecyclerView.ViewHolder { ImageView img_brand,img_wishlist; TextView txt_brandname,txt_brand_price,txt_brand_item,txt_count; public ImageView getImg_brand() { return img_brand; } public ImageView getImg_wishlist() { return img_wishlist; } public TextView getTxt_brandname() { return txt_brandname; } public TextView getTxt_brand_price() { return txt_brand_price; } public TextView getTxt_brand_item() { return txt_brand_item; } public TextView getTxt_count() { return txt_count; } FeaturedView(@NonNull View itemView) { super(itemView); img_brand=itemView.findViewById(R.id.img_brand); img_wishlist=itemView.findViewById(R.id.img_wishlist); txt_brandname=itemView.findViewById(R.id.txt_brandname); txt_brand_price=itemView.findViewById(R.id.txt_brand_price); txt_brand_item=itemView.findViewById(R.id.txt_brand_item); txt_count=itemView.findViewById(R.id.txt_count); img_wishlist.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String value = txt_count.getText().toString(); if (value.equals("0")) { img_wishlist.setColorFilter(Color.argb(255, 255, 0, 0)); txt_count.setText("1"); } else if (value.equals("1")) { img_wishlist.setColorFilter(Color.argb(255, 211, 211, 211)); txt_count.setText("0"); } onclickListener.wishlistOnclick(v,getAdapterPosition()); } }); img_brand.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onclickListener.brandOnClick(v,getAdapterPosition()); } }); } } private MyAdapterListener onclickListener; public interface MyAdapterListener { void wishlistOnclick(View view ,int position); void brandOnClick(View view,int position); } } ,可能与LANGUAGE结合使用。试试这个:

LANG

您可以在文件export LANGUAGE=pt_BR:pt_PT:pt:es_ES:es:en export LANG=pt_BR 中找到更多详细信息,该文件随国际化软件包一起安装,也可以在http://www.sensi.org/~alec/locale/other/about-nls.html在线获取。