Index: filters/localise_path.py |
diff --git a/filters/localise_path.py b/filters/localise_path.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..eb4be8ed1bd547c92922563eb76a887cd19a263d |
--- /dev/null |
+++ b/filters/localise_path.py |
@@ -0,0 +1,22 @@ |
+# This file is part of the Adblock Plus website, |
+# Copyright (C) 2006-2015 Eyeo GmbH |
+# |
+# Adblock Plus is free software: you can redistribute it and/or modify |
+# it under the terms of the GNU General Public License version 3 as |
+# published by the Free Software Foundation. |
+# |
+# Adblock Plus is distributed in the hope that it will be useful, |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+# GNU General Public License for more details. |
+# |
+# You should have received a copy of the GNU General Public License |
+# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
+ |
+import os |
+ |
+def localise_path(path, locale): |
+ for prefix in (("locales", locale), ("locales", "en"), ("static",)): |
+ full_path = os.path.join(*prefix + (path,)) |
+ if os.path.isfile(full_path): |
+ return full_path |