Add localizable strings to two extensions & translate them

This commit is contained in:
Yokayo
2024-05-04 02:44:15 +07:00
parent 7bc87b6e28
commit 29e2e8f607
6 changed files with 178 additions and 69 deletions

View File

@ -8,16 +8,16 @@
<div class="flex-container">
<div id="open_regex_editor" class="menu_button">
<i class="fa-solid fa-pen-to-square"></i>
<span>Open Editor</span>
<span data-i18n="regex_open_editor">Open Editor</span>
</div>
<div id="import_regex" class="menu_button">
<i class="fa-solid fa-file-import"></i>
<span>Import Script</span>
<span data-i18n="regex_import_script">Import Script</span>
</div>
<input type="file" id="import_regex_file" hidden accept="*.json" />
</div>
<hr />
<label>Saved Scripts</label>
<label data-i18n="regex_saved_scripts">Saved Scripts</label>
<div id="saved_regex_scripts" class="flex-container regex-script-container flexFlowColumn"></div>
</div>
</div>

View File

@ -11,7 +11,7 @@
</div>
</h3>
<small class="flex-container extensions_info">
<small class="flex-container extensions_info" data-i18n="ext_regex_desc">
Regex is a tool to find/replace strings using regular expressions. If you want to learn more, click on the ? next to the title.
</small>
<hr />
@ -21,13 +21,13 @@
<label class="title_restorable" for="regex_test_input">
<small data-i18n="Input">Input</small>
</label>
<textarea id="regex_test_input" class="text_pole textarea_compact" rows="4" placeholder="Type here..."></textarea>
<textarea id="regex_test_input" class="text_pole textarea_compact" rows="4" data-i18n="[placeholder]ext_regex_test_input_placeholder" placeholder="Type here..."></textarea>
</div>
<div class="flex1">
<label class="title_restorable" for="regex_test_output">
<small data-i18n="Output">Output</small>
</label>
<textarea id="regex_test_output" class="text_pole textarea_compact" rows="4" placeholder="Empty" readonly></textarea>
<textarea id="regex_test_output" class="text_pole textarea_compact" rows="4" data-i18n="[placeholder]ext_regex_output_placeholder" placeholder="Empty" readonly></textarea>
</div>
<hr>
</div>
@ -56,6 +56,7 @@
<div>
<textarea
class="regex_replace_string text_pole wide100p textarea_compact"
data-i18n="[placeholder]ext_regex_replace_string_placeholder"
placeholder="Use {{match}} to include the matched text from the Find Regex or $1, $2, etc. for capture groups."
rows="2"
></textarea>
@ -67,7 +68,7 @@
</label>
<div>
<textarea
class="regex_trim_strings text_pole wide100p textarea_compact"
class="regex_trim_strings text_pole wide100p textarea_compact" data-i18n="[placeholder]ext_regex_trim_placeholder"
placeholder="Globally trims any unwanted parts from a regex match before replacement. Separate each element by an enter."
rows="3"
></textarea>
@ -77,17 +78,17 @@
<div class="flex-container">
<div class="flex1 wi-enter-footer-text flex-container flexFlowColumn flexNoGap alignitemsstart">
<small>Affects</small>
<small data-i18n="ext_regex_affects">Affects</small>
<div>
<label class="checkbox flex-container">
<input type="checkbox" name="replace_position" value="1">
<span data-i18n="Before Char">User Input</span>
<span data-i18n="ext_regex_user_input">User Input</span>
</label>
</div>
<div>
<label class="checkbox flex-container">
<input type="checkbox" name="replace_position" value="2">
<span data-i18n="After Char">AI Output</span>
<span data-i18n="ext_regex_ai_output">AI Output</span>
</label>
</div>
<div>
@ -98,23 +99,23 @@
</div>
<div class="flex-container wide100p marginTop5">
<div class="flex1 flex-container flexNoGap">
<small title="When applied to prompts or display, only affect messages that are at least N levels deep. 0 = last message, 1 = penultimate message, etc. Only counts usable messages, i.e. not hidden or system.">
<small data-i18n="[title]ext_regex_min_depth_desc" title="When applied to prompts or display, only affect messages that are at least N levels deep. 0 = last message, 1 = penultimate message, etc. Only counts usable messages, i.e. not hidden or system.">
<span data-i18n="Min Depth">Min Depth</span>
<span class="fa-solid fa-circle-question note-link-span"></span>
</small>
<input name="min_depth" class="text_pole textarea_compact" type="number" min="0" max="999" placeholder="Unlimited" />
<input name="min_depth" class="text_pole textarea_compact" type="number" min="0" max="999" data-i18n="[placeholder]ext_regex_min_depth_placeholder" placeholder="Unlimited" />
</div>
<div class="flex1 flex-container flexNoGap">
<small title="When applied to prompts or display, only affect messages no more than N levels deep. 0 = last message, 1 = penultimate message, etc. Only counts usable messages, i.e. not hidden or system.">
<small data-i18n="[title]ext_regex_max_depth_desc" title="When applied to prompts or display, only affect messages no more than N levels deep. 0 = last message, 1 = penultimate message, etc. Only counts usable messages, i.e. not hidden or system.">
<span data-i18n="Max Depth">Max Depth</span>
<span class="fa-solid fa-circle-question note-link-span"></span>
</small>
<input name="max_depth" class="text_pole textarea_compact" type="number" min="0" max="999" placeholder="Unlimited" />
<input name="max_depth" class="text_pole textarea_compact" type="number" min="0" max="999" data-i18n="[placeholder]ext_regex_min_depth_placeholder" placeholder="Unlimited" />
</div>
</div>
</div>
<div class="flex1 wi-enter-footer-text flex-container flexFlowColumn flexNoGap alignitemsstart">
<small>Other Options</small>
<small data-i18n="ext_regex_other_options">Other Options</small>
<label class="checkbox flex-container">
<input type="checkbox" name="disabled" />
<span data-i18n="Disabled">Disabled</span>
@ -123,7 +124,7 @@
<input type="checkbox" name="only_format_display" />
<span data-i18n="Only Format Display">Only Format Display</span>
</label>
<label class="checkbox flex-container" title="Chat history won't change, only the prompt as the request is sent (on generation)">
<label class="checkbox flex-container" data-i18n="[title]ext_regex_only_format_prompt_desc" title="Chat history won't change, only the prompt as the request is sent (on generation)">
<input type="checkbox" name="only_format_prompt"/>
<span>
<span data-i18n="Only Format Prompt (?)">Only Format Prompt</span>
@ -134,7 +135,7 @@
<input type="checkbox" name="run_on_edit" />
<span data-i18n="Run On Edit">Run On Edit</span>
</label>
<label class="checkbox flex-container" title="Substitute {{macros}} in Find Regex before running it">
<label class="checkbox flex-container" data-i18n="[title]ext_regex_substitute_regex_desc" title="Substitute {{macros}} in Find Regex before running it">
<input type="checkbox" name="substitute_regex" />
<span>
<span data-i18n="Substitute Regex">Substitute Regex</span>

View File

@ -4,16 +4,16 @@
<div class="flex-container flexnowrap">
<label class="checkbox flex-container" for="regex_disable">
<input type="checkbox" name="regex_disable" class="disable_regex" />
<span class="regex-toggle-on fa-solid fa-toggle-on" title="Disable script"></span>
<span class="regex-toggle-off fa-solid fa-toggle-off" title="Enable script"></span>
<span class="regex-toggle-on fa-solid fa-toggle-on" data-i18n="[title]regex_disable_script" title="Disable script"></span>
<span class="regex-toggle-off fa-solid fa-toggle-off" data-i18n="[title]regex_enable_script" title="Enable script"></span>
</label>
<div class="edit_existing_regex menu_button" title="Edit script">
<div class="edit_existing_regex menu_button" data-i18n="[title]regex_edit_script" title="Edit script">
<i class="fa-solid fa-pencil"></i>
</div>
<div class="export_regex menu_button" title="Export script">
<div class="export_regex menu_button" data-i18n="[title]regex_export_script" title="Export script">
<i class="fa-solid fa-file-export"></i>
</div>
<div class="delete_regex menu_button" title="Delete script">
<div class="delete_regex menu_button" data-i18n="[title]regex_delete_script" title="Delete script">
<i class="fa-solid fa-trash"></i>
</div>
</div>