From 8e304b83c685dde17a00d402877a21303b7c11f2 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 3 Jan 2021 12:12:55 -0500 Subject: Translator regex replacements (#1199) * Add support for regex replacements during the translation process * Allow assignment of textReplacements * Rename * Set up test data * Write expected data * Set up options * Prevent infinite loop if regex matches empty string * Implement setting controller * Add support for testing pattern replacements --- ext/bg/css/settings2.css | 107 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) (limited to 'ext/bg/css') diff --git a/ext/bg/css/settings2.css b/ext/bg/css/settings2.css index 8759e941..9d3d081d 100644 --- a/ext/bg/css/settings2.css +++ b/ext/bg/css/settings2.css @@ -1732,6 +1732,113 @@ code.anki-field-marker { height: calc(0.425em * 4 + 1em * var(--line-height-default) * 3); } +#translation-text-replacement-list-empty { + display: none; +} +#translation-text-replacement-list:empty+#translation-text-replacement-list-empty { + display: block; +} +.translation-text-replacement-entry { + display: grid; + grid-template-columns: auto auto 1fr auto; + grid-template-rows: auto; + grid-template-areas: + "index pattern-label pattern button" + ". replacement-label replacement button" + ". test-label test ."; + column-gap: 0.25em; + row-gap: 0.25em; + align-items: stretch; + justify-items: stretch; +} +.translation-text-replacement-entry+.translation-text-replacement-entry { + margin-top: 0.5em; +} +.translation-text-replacement-index { + grid-area: index; + align-self: center; + justify-self: start; + padding-right: 0.5em; +} +.translation-text-replacement-pattern-label { + grid-area: pattern-label; + align-self: center; + justify-self: start; + padding-right: 0.5em; +} +.translation-text-replacement-replacement-label { + grid-area: replacement-label; + align-self: center; + justify-self: start; + padding-right: 0.5em; +} +.translation-text-replacement-pattern-container { + grid-area: pattern; + align-self: stretch; + justify-self: stretch; + display: flex; + flex-flow: row nowrap; + align-items: stretch; +} +.translation-text-replacement-replacement-container { + grid-area: replacement; + align-self: stretch; + justify-self: stretch; + display: flex; + flex-flow: row nowrap; + align-items: stretch; +} +input.translation-text-replacement-pattern, +input.translation-text-replacement-replacement { + flex: 1 1 auto; + width: auto; +} +.translation-text-replacement-checkbox-container { + white-space: nowrap; + display: flex; + flex-flow: row nowrap; + align-items: center; + padding-left: 0.5em; +} +.translation-text-replacement-checkbox-label { + padding-left: 0.5em; +} +.translation-text-replacement-button { + grid-area: button; + align-self: center; + justify-self: start; +} +.translation-text-replacement-test-label { + grid-area: test-label; + align-self: center; + justify-self: start; + padding-right: 0.5em; +} +.translation-text-replacement-test-container { + grid-area: test; + align-self: stretch; + justify-self: stretch; + display: flex; + flex-flow: row nowrap; + align-items: stretch; +} +input.translation-text-replacement-test-input, +input.translation-text-replacement-test-output { + flex: 1 1 auto; + width: auto; +} +.translation-text-replacement-test-label-inner { + grid-area: button; + align-self: center; + justify-self: start; + flex: 0 0 auto; + padding: 0 0.5em; + white-space: nowrap; +} +.translation-text-replacement-entry:not([data-test-visible=true]) .translation-text-replacement-test-node { + display: none; +} + /* Generic layouts */ .margin-above { -- cgit v1.2.3