mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
Firefox: Title Case Context Menu Entry
This commit is contained in:
parent
14e6860c30
commit
37540a0196
1 changed files with 11 additions and 5 deletions
|
@ -24,15 +24,16 @@ source_locale_dir = pj(build_dir, '_locales')
|
||||||
target_locale_dir = pj(build_dir, 'locale')
|
target_locale_dir = pj(build_dir, 'locale')
|
||||||
language_codes = []
|
language_codes = []
|
||||||
descriptions = OrderedDict({})
|
descriptions = OrderedDict({})
|
||||||
|
title_case_strings = ['pickerContextMenuEntry']
|
||||||
|
|
||||||
for alpha2 in sorted(os.listdir(source_locale_dir)):
|
for alpha2 in sorted(os.listdir(source_locale_dir)):
|
||||||
locale_path = pj(source_locale_dir, alpha2, 'messages.json')
|
locale_path = pj(source_locale_dir, alpha2, 'messages.json')
|
||||||
with open(locale_path, encoding='utf-8') as f:
|
with open(locale_path, encoding='utf-8') as f:
|
||||||
string_data = json.load(f, object_pairs_hook=OrderedDict)
|
strings = json.load(f, object_pairs_hook=OrderedDict)
|
||||||
|
|
||||||
alpha2 = alpha2.replace('_', '-')
|
alpha2 = alpha2.replace('_', '-')
|
||||||
descriptions[alpha2] = string_data['extShortDesc']['message']
|
descriptions[alpha2] = strings['extShortDesc']['message']
|
||||||
del string_data['extShortDesc']
|
del strings['extShortDesc']
|
||||||
|
|
||||||
language_codes.append(alpha2)
|
language_codes.append(alpha2)
|
||||||
|
|
||||||
|
@ -40,10 +41,15 @@ for alpha2 in sorted(os.listdir(source_locale_dir)):
|
||||||
|
|
||||||
locale_path = pj(target_locale_dir, alpha2, 'messages.properties')
|
locale_path = pj(target_locale_dir, alpha2, 'messages.properties')
|
||||||
with open(locale_path, 'wt', encoding='utf-8', newline='\n') as f:
|
with open(locale_path, 'wt', encoding='utf-8', newline='\n') as f:
|
||||||
for string_name in string_data:
|
for string_name in strings:
|
||||||
|
string = strings[string_name]['message']
|
||||||
|
|
||||||
|
if alpha2 == 'en' and string_name in title_case_strings:
|
||||||
|
string = string.title()
|
||||||
|
|
||||||
f.write(string_name)
|
f.write(string_name)
|
||||||
f.write(u'=')
|
f.write(u'=')
|
||||||
f.write(string_data[string_name]['message'].replace('\n', r'\n'))
|
f.write(string.replace('\n', r'\n'))
|
||||||
f.write(u'\n')
|
f.write(u'\n')
|
||||||
|
|
||||||
# generate chrome.manifest file
|
# generate chrome.manifest file
|
||||||
|
|
Loading…
Reference in a new issue