mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
commit
922e638133
@ -13,7 +13,7 @@
|
|||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.7.2.0</string>
|
<string>0.8.1.2</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>Chrome</key>
|
<key>Chrome</key>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<key>Developer Identifier</key>
|
<key>Developer Identifier</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.7.0.11</string>
|
<string>0.8.1.2</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>URL</key>
|
<key>URL</key>
|
||||||
|
@ -36,7 +36,7 @@ self.vAPI = self.vAPI || {};
|
|||||||
var setScriptDirection = function(language) {
|
var setScriptDirection = function(language) {
|
||||||
document.body.setAttribute(
|
document.body.setAttribute(
|
||||||
'dir',
|
'dir',
|
||||||
~['ar', 'he', 'fa', 'ps', 'ur'].indexOf(language) ? 'rtl' : 'ltr'
|
['ar', 'he', 'fa', 'ps', 'ur'].indexOf(language) !== -1 ? 'rtl' : 'ltr'
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -77,12 +77,12 @@ vAPI.getURL = function(path) {
|
|||||||
// supported languages
|
// supported languages
|
||||||
// first language is the default
|
// first language is the default
|
||||||
vAPI.i18nData = [
|
vAPI.i18nData = [
|
||||||
"en", "ar", "cs", "da", "de", "el", "es", "et", "fi", "fr", "he", "hi",
|
'en', 'ar', 'cs', 'da', 'de', 'el', 'es', 'et', 'fi', 'fil', 'fr', 'he',
|
||||||
"hr", "hu", "id", "it", "ja", "mr", "nb", "nl", "pl", "pt_BR", "pt_PT",
|
'hi', 'hr', 'hu', 'id', 'it', 'ja', 'mr', 'nb', 'nl', 'pl', 'pt-BR',
|
||||||
"ro", "ru", "sv", "tr", "uk", "vi", "zh_CN"
|
'pt-PT', 'ro', 'ru', 'sv', 'tr', 'uk', 'vi', 'zh-CN'
|
||||||
];
|
];
|
||||||
|
|
||||||
vAPI.i18n = navigator.language.replace('-', '_');
|
vAPI.i18n = navigator.language;
|
||||||
|
|
||||||
if (vAPI.i18nData.indexOf(vAPI.i18n) === -1) {
|
if (vAPI.i18nData.indexOf(vAPI.i18n) === -1) {
|
||||||
vAPI.i18n = vAPI.i18n.slice(0, 2);
|
vAPI.i18n = vAPI.i18n.slice(0, 2);
|
||||||
@ -96,14 +96,10 @@ setScriptDirection(vAPI.i18n);
|
|||||||
|
|
||||||
var xhr = new XMLHttpRequest;
|
var xhr = new XMLHttpRequest;
|
||||||
xhr.overrideMimeType('application/json;charset=utf-8');
|
xhr.overrideMimeType('application/json;charset=utf-8');
|
||||||
xhr.open('GET', './_locales/' + vAPI.i18n + '/messages.json', false);
|
xhr.open('GET', './_locales/' + vAPI.i18n + '.json', false);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
vAPI.i18nData = JSON.parse(xhr.responseText);
|
vAPI.i18nData = JSON.parse(xhr.responseText);
|
||||||
|
|
||||||
for (var i18nKey in vAPI.i18nData) {
|
|
||||||
vAPI.i18nData[i18nKey] = vAPI.i18nData[i18nKey].message;
|
|
||||||
}
|
|
||||||
|
|
||||||
vAPI.i18n = function(s) {
|
vAPI.i18n = function(s) {
|
||||||
return this.i18nData[s] || s;
|
return this.i18nData[s] || s;
|
||||||
};
|
};
|
||||||
|
@ -84,14 +84,14 @@ p {
|
|||||||
background-color: #fffff4;
|
background-color: #fffff4;
|
||||||
border: 1px solid #888;
|
border: 1px solid #888;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
bottom: 20vh;
|
bottom: 20%;
|
||||||
box-shadow: 1px 1px 2px 0 rgba(0,0,0,0.8);
|
box-shadow: 1px 1px 2px 0 rgba(0,0,0,0.8);
|
||||||
display: none;
|
display: none;
|
||||||
font-size: small;
|
font-size: small;
|
||||||
left: 8vw;
|
left: 8%;
|
||||||
padding: 0.25em;
|
padding: 0.25em;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 8vw;
|
right: 8%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.dynamicFiltering div:not(.blocked):hover > .tip:nth-of-type(1) {
|
.dynamicFiltering div:not(.blocked):hover > .tip:nth-of-type(1) {
|
||||||
|
39
tools/make-locale-safari.py
Normal file
39
tools/make-locale-safari.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
from shutil import rmtree
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
if not sys.argv[1]:
|
||||||
|
raise SystemExit('Build dir missing.')
|
||||||
|
|
||||||
|
|
||||||
|
def mkdirs(path):
|
||||||
|
try:
|
||||||
|
os.makedirs(path)
|
||||||
|
finally:
|
||||||
|
return os.path.exists(path)
|
||||||
|
|
||||||
|
|
||||||
|
build_dir = os.path.abspath(sys.argv[1])
|
||||||
|
locale_dir = os.path.join(build_dir, '_locales')
|
||||||
|
|
||||||
|
for alpha2 in os.listdir(locale_dir):
|
||||||
|
locale_path = os.path.join(locale_dir, alpha2, 'messages.json')
|
||||||
|
with open(locale_path, encoding='utf-8') as f:
|
||||||
|
string_data = json.load(f, object_pairs_hook=OrderedDict)
|
||||||
|
|
||||||
|
for string_name in string_data:
|
||||||
|
string_data[string_name] = string_data[string_name]['message']
|
||||||
|
|
||||||
|
rmtree(os.path.join(locale_dir, alpha2))
|
||||||
|
|
||||||
|
alpha2 = alpha2.replace('_', '-')
|
||||||
|
locale_path = os.path.join(locale_dir, alpha2 + '.json')
|
||||||
|
|
||||||
|
mkdirs(os.path.join(locale_dir))
|
||||||
|
|
||||||
|
with open(locale_path, 'wt', encoding='utf-8', newline='\n') as f:
|
||||||
|
json.dump(string_data, f, ensure_ascii=False)
|
@ -18,4 +18,8 @@ cp src/img/icon_128.png $DES/Icon.png
|
|||||||
cp platform/safari/*.js $DES/js/
|
cp platform/safari/*.js $DES/js/
|
||||||
cp platform/safari/Info.plist $DES/
|
cp platform/safari/Info.plist $DES/
|
||||||
cp platform/safari/Settings.plist $DES/
|
cp platform/safari/Settings.plist $DES/
|
||||||
|
|
||||||
|
echo "*** uBlock_xpi: Generating locales"
|
||||||
|
python tools/make-locale-safari.py $DES/
|
||||||
|
|
||||||
echo "*** uBlock.safariextension: Package done."
|
echo "*** uBlock.safariextension: Package done."
|
||||||
|
Loading…
Reference in New Issue
Block a user