aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-08-01 13:43:14 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-03 20:16:10 +0000
commitb4e84e29ffcced2dd977e01482c7f3d9adc8363b (patch)
tree726b0c366ce7014ba040fe2708ee7a2867b3a6f1
parent2ad3cb427a57a2d5bbb8cb68fed7539f71685b43 (diff)
snippet translate: Fix error
Adapt to get_snippets() returning a list after 168f0c941cefe2fcdaaa12498272f181fe246986: File "pyside-setup-devt/tools/snippets_translate/converter.py", line 21, in snippet_translate if x.strip().startswith("content-type: text/html"): AttributeError: 'list' object has no attribute 'strip' Change-Id: I3366b6fcf7647e24cf50ad7afe1f62ff0d04f9e2 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit b5ca9db036e9380c05b2291cefe9b0b4f735fcce) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tools/snippets_translate/main.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/snippets_translate/main.py b/tools/snippets_translate/main.py
index ec58e87a9..f7220511a 100644
--- a/tools/snippets_translate/main.py
+++ b/tools/snippets_translate/main.py
@@ -279,19 +279,20 @@ def translate_file(file_path, final_path, debug, write):
table.add_column("Python")
translated_lines = []
- for line in snippets:
- if not line:
- continue
- translated_line = snippet_translate(line)
- translated_lines.append(translated_line)
-
- # logging
- if debug:
- if have_rich:
- table.add_row(line, translated_line)
- else:
- if not opt_quiet:
- print(line, translated_line)
+ for snippet in snippets:
+ for line in snippet:
+ if not line:
+ continue
+ translated_line = snippet_translate(line)
+ translated_lines.append(translated_line)
+
+ # logging
+ if debug:
+ if have_rich:
+ table.add_row(line, translated_line)
+ else:
+ if not opt_quiet:
+ print(line, translated_line)
if debug and have_rich:
if not opt_quiet: