Add translation options

This commit is contained in:
toasted-nutbread 2019-12-22 13:50:30 -05:00
parent 9ae87f186a
commit 4415a71ae2
3 changed files with 57 additions and 0 deletions

View File

@ -319,6 +319,13 @@ function profileOptionsCreateDefaults() {
enableOnSearchPage: true
},
translation: {
convertKatakanaToHiragana: 'variant',
convertHalfWidthCharacters: 'false',
convertNumericCharacters: 'false',
convertAlphabeticCharacters: 'false'
},
dictionaries: {},
parsing: {

View File

@ -72,6 +72,11 @@ async function formRead(options) {
options.scanning.modifier = $('#scan-modifier-key').val();
options.scanning.popupNestingMaxDepth = parseInt($('#popup-nesting-max-depth').val(), 10);
options.translation.convertKatakanaToHiragana = $('#translation-convert-katakana-to-hiragana').val();
options.translation.convertHalfWidthCharacters = $('#translation-convert-half-width-characters').val();
options.translation.convertNumericCharacters = $('#translation-convert-numeric-characters').val();
options.translation.convertAlphabeticCharacters = $('#translation-convert-alphabetic-characters').val();
options.parsing.enableScanningParser = $('#parsing-scan-enable').prop('checked');
options.parsing.enableMecabParser = $('#parsing-mecab-enable').prop('checked');
options.parsing.readingMode = $('#parsing-reading-mode').val();
@ -140,6 +145,11 @@ async function formWrite(options) {
$('#scan-modifier-key').val(options.scanning.modifier);
$('#popup-nesting-max-depth').val(options.scanning.popupNestingMaxDepth);
$('#translation-convert-katakana-to-hiragana').val(options.translation.convertKatakanaToHiragana);
$('#translation-convert-half-width-characters').val(options.translation.convertHalfWidthCharacters);
$('#translation-convert-numeric-characters').val(options.translation.convertNumericCharacters);
$('#translation-convert-alphabetic-characters').val(options.translation.convertAlphabeticCharacters);
$('#parsing-scan-enable').prop('checked', options.parsing.enableScanningParser);
$('#parsing-mecab-enable').prop('checked', options.parsing.enableMecabParser);
$('#parsing-reading-mode').val(options.parsing.readingMode);

View File

@ -397,6 +397,46 @@
</div>
</div>
<div>
<h3>Translation Options</h3>
<div class="form-group">
<label for="translation-convert-katakana-to-hiragana">Convert katakana to hiragana <span class="label-light">(ヨミチャン &rarr; よみちゃん)</span></label>
<select class="form-control" id="translation-convert-katakana-to-hiragana">
<option value="false">Disabled</option>
<option value="true">Enabled</option>
<option value="variant">Use both variants</option>
</select>
</div>
<div class="form-group">
<label for="translation-convert-half-width-characters">Convert half width characters to full width <span class="label-light">(ヨミチャン &rarr; ヨミチャン)</span></label>
<select class="form-control" id="translation-convert-half-width-characters">
<option value="false">Disabled</option>
<option value="true">Enabled</option>
<option value="variant">Use both variants</option>
</select>
</div>
<div class="form-group">
<label for="translation-convert-numeric-characters">Convert numeric characters to full width <span class="label-light">(1234 &rarr; )</span></label>
<select class="form-control" id="translation-convert-numeric-characters">
<option value="false">Disabled</option>
<option value="true">Enabled</option>
<option value="variant">Use both variants</option>
</select>
</div>
<div class="form-group">
<label for="translation-convert-alphabetic-characters">Convert alphabetic characters to hiragana <span class="label-light">(yomichan &rarr; よみちゃん)</span></label>
<select class="form-control" id="translation-convert-alphabetic-characters">
<option value="false">Disabled</option>
<option value="true">Enabled</option>
<option value="variant">Use both variants</option>
</select>
</div>
</div>
<div id="popup-content-scanning">
<h3>Popup Content Scanning Options</h3>