Django中的多个区域设置文件查找 [英] Multiple locale file lookup in Django

查看:120
本文介绍了Django中的多个区域设置文件查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Django应用程序中,我有通常的每个语言的 django.po 区域设置文件。但是,我想创建一个名为 custom.po 的自定义区域设置文件。有没有办法我可以Django首先检查 custom.po 文件中的翻译字符串,如果不存在,请查看 django .po 文件

In my Django app i have the usual django.po locale file under each of the languages. However, I'd like to create a custom locale file called custom.po. Is there any way I could Django to first check for a translation string in the custom.po file and if it doesn't exist, check the django.po file

谢谢。

推荐答案

p>检查 LOCALE_PATHS 设置。这个元组是特定于订单的,所以如果你把路径放在你的 custom.po 之前,你将会实现你以后的效果。

Check the LOCALE_PATHS setting. This tuple is order-specific, so if you put the path to your custom.po first, you will achieve the effect you're after.

修改:有关 Django如何发现翻译

这篇关于Django中的多个区域设置文件查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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