Load per-prefix data from the given top-level directory. Prefix data is assumed to be held in files / / .txt. The same prefix may occur in multiple files, giving the prefix's description in different locales.
(indir, separator=None)
| 129 | |
| 130 | |
| 131 | def load_locale_prefixdata(indir, separator=None): |
| 132 | """Load per-prefix data from the given top-level directory. |
| 133 | |
| 134 | Prefix data is assumed to be held in files <indir>/<locale>/<prefix>.txt. |
| 135 | The same prefix may occur in multiple files, giving the prefix's description |
| 136 | in different locales. |
| 137 | """ |
| 138 | prefixdata = {} # prefix => dict mapping locale to description |
| 139 | for locale in os.listdir(indir): |
| 140 | if not os.path.isdir(os.path.join(indir, locale)): |
| 141 | continue |
| 142 | for filename in glob.glob(os.path.join(indir, locale, "*%s" % PREFIXDATA_SUFFIX)): |
| 143 | overall_prefix, ext = os.path.splitext(os.path.basename(filename)) |
| 144 | load_locale_prefixdata_file(prefixdata, filename, locale, overall_prefix, separator) |
| 145 | return prefixdata |
| 146 | |
| 147 | |
| 148 | def _stable_dict_repr(strdict): |
no test coverage detected