Custom XML filter for WPML XLIFF - how to make sure not to show for translation some HTML values

Hi!

I have a custom XML filter for WPML XLIFF files I am happy to share:

wordpress-xliff-1.2-Trados22.sdlftsettings.zip

Example files:

ru.zip

The issue is that the website is created with the Kallyas pagebuilder and there is a lot of settings that should not be translated.

Screenshot of a translation software interface showing a list of XML tags with some marked for translation and others not, with a focus on custom subheader layout tags.

Manually locking these segments is time consuming. I am looking for a shotcut solution.

I have created a DNT list:

#
#contact-form
#fffffff
_blank
_self
+359 700 11 502
10xp
1px 1px 0 rgba(255,255,255,.5)
1px 1px 50px rgba(0,0,0,.4)
advantages-section
after-title
AIzaSyD9TqTOMRLgyslCtiheog1Dy-Rx2-0iLzI
all
arial
auto
before
bg
border
border2
bottom-left
bottom-right
BOUNCE
btn-fullcolor
btn-fullcolor btn-custom-color
btn-halfwidth
btn-lined
btn-lined btn-custom-color
btn-lined lined-full-light
btn-md
btn-primary
btn--rounded
btn-third
center
col-lg-4
col-lg-offset-0
col-lg-offset-3
col-md-10
col-md-12
col-md-2
col-md-4
col-md-6
col-md-8
col-sm-12
container
cover
custom
dark
default
dynamic
eluid022df3e9
eluid04c5aec0
eluid077d88d4
eluid0a166025
eluid0c00908f
eluid0f98263b
eluid15027107
eluid156e7b23
eluid15bd14f6
eluid16bea07d
eluid19f5d0f0
eluid1a3765be
eluid1b031a5c
eluid1b68f19d
eluid1ca49326
eluid2131052e
eluid22688afa
eluid2335a714
eluid23653496
eluid25b30795
eluid292fb56b
eluid299285c0
eluid2a190a71
eluid2ab6552d
eluid2af43c66
eluid2d00695d
eluid2d395104
eluid2e16bce3
eluid378727a2
eluid38836e29
eluid39a4bcf6
eluid39e692b5
eluid3a1fcd02
eluid3bb8c13c
eluid3bea40f9
eluid3ed8020d
eluid3f9972da
eluid3ff03ed5
eluid47866c9c
eluid4827b2e6
eluid49385d95
eluid4a2effdd
eluid4a675b6c
eluid4c04cefc
eluid4c342995
eluid511711a9
eluid51372e49
eluid51ecc613
eluid5517f149
eluid5634d526
eluid563de37c
eluid56c6d6d5
eluid572d7987
eluid5787df79
eluid582b9cc3
eluid58b70d39
eluid5da1a6a5
eluid5f51c6fa
eluid5f58cddb
eluid63ee6290
eluid66c2941c
eluid6751ed77
eluid6799ae03
eluid6a112b8e
eluid6b8ed78c
eluid6d6aa085
eluid6e5deeaa
eluid6ea6821a
eluid6ef7509d
eluid6f9b2655
eluid6ff533e5
eluid70cde5fa
eluid73733366
eluid75a64a89
eluid76444380
eluid77e9518e
eluid78387f20
eluid7ddb7447
eluid82e21f98
eluid82ed341d
eluid843248f0
eluid8487535f
eluid856a80b7
eluid87efbeff
eluid88f509af
eluid8956f512
eluid8a17e471
eluid8c6ba42c
eluid8d8cddec
eluid8e43ce0f
eluid8f9e1ebe
eluid9228084a
eluid924f7256
eluid93cea83e
eluid960b7d87
eluid965823ac
eluid9816d84b
eluid98b14bb4
eluid9941b5e6
eluid9a9b3cd2
eluid9b6f0c68
eluid9c363cce
eluid9c571245
eluid9cf90f5a
eluid9d1dec19
eluid9ff2bc13
eluida17b8c08
eluida3a76d77
eluida4a0afe1
eluida5b5da44
eluida9e80346
eluidaa608885
eluidaa7a116b
eluidab142c57
eluidada689fd
eluidadf62c90
eluidae73a497
eluidafbf0d0a
eluidafc9e1c0
eluidb051f74e
eluidb1eaeb28
eluidb413df32
eluidb602d894
eluidb694af38
eluidb7882889
eluidb7c695b3
eluidb800e051
eluidb8c6bf53
eluidb91bc990
eluidbaddaecd
eluidbbd74bd0
eluidbc157a7b
eluidbc180a58
eluidbcc31f31
eluidbfda9919
eluidc0e39f82
eluidc2965712
eluidc5134011
eluidc70f5449
eluidc99abfbc
eluidca7f53c1
eluidcbfffe79
eluidd2a0b580
eluidd97b39db
eluide2511b40
eluide385f8e4
eluide772b851
eluidea2ce041
eluideaecba6b
eluidec5ad4e9
eluided2408ae
eluidef211cb6
eluidf0479c1a
eluidf1e1f7be
eluidfbe5d907
eluidfc024ba3
eluidfc1bf4c6
eluidfd69f1c1
eluidfd6eac5d
eluidffde714a
fancy
fixed
Flaticon
full_width
glyphicons_halflingsregular
gradient
grid-ibx--hover-bg
gutter-lg
h3
h4
helvetica
home
hover
hover-box
oltrans.bg/.../Ekip2024.jpg
oltrans.bg/.../18-years.png
g.page/.../review
oltrans.bg/.../Plovdiv-4optimized-1200x800-optimized.jpg
oltrans.bg/.../monument-2013682_1280.jpg
oltrans.bg/.../plovdiv-1613984_1280.jpg
oltrans.bg/.../plovdiv-2030532_1280.jpg
oltrans.bg/.../sunset-3218147_1280.jpg
oltrans.bg/.../the-old-town-670457_1280.jpg
oltrans.bg/.../calligraphy-2658504_1200x500.jpg
oltrans.bg/.../Rimski-stadion.jpg
oltrans.bg/.../elia.png
oltrans.bg/.../iso.png
oltrans.bg/.../Background-light.jpg
oltrans.bg/.../kti-logo-dark.png
oltrans.bg/.../Machine-translation-2.png
oltrans.bg/.../Obiknoven-prevod-1.png
oltrans.bg/.../profesionalen-prevod-1.png
oltrans.bg/.../Specialised-file-format-1200h628.jpg
oltrans.bg/.../ssm-logo0x0.png
icon
icontitle
image
img
imgboxes_style1
info@sotirr.sg-host.com
infobox
inline_left
is_email
is_numeric
kl-social-icons
large
left
lg
light
linear
mask3
mask4 mask4l
mask5
masonry
md
min-height
no
noleftpadding
none
no-repeat
norightpadding
normal
not_empty
pixel
Power1.easeOut
px
resp
right
ROADMAP
scroll
select
short
solid
Statistics
style1
style2
style3
text
textarea
tgg
TH_Accordion
TH_Buttons
TH_CallOutBanner
TH_CircleTitleTextBox
TH_CustomSubHeaderLayout
TH_GridPhotoGallery
TH_HoverBox
TH_IconBox
TH_IconBoxesGrid
TH_ImageBox
TH_InfoBox2
TH_Skills
TH_SpacerElement
TH_Statistics
TH_StepsBox2
TH_StepsBox4
TH_TeamBox
TH_TextBox
TH_TitleElement
theme
title_style_center
top
topright
trebuchet
u2709
ue008
ue013
ue022
ue041
ue055
ue062
ue065
ue177
ue178
ue182
ue224
ue236
ue814
ue836
uf189
verdana
xs
yes
yy-mm-dd
zn_def_header_style
zn_dummy_value
zn_fill_class
ZnAnchorPoint
ZNB_Button
ZnColumn
ZnContactForm
ZnGoogleMap
ZnSection

Usually I would go with placeholders, but I did not see such option in the custom XML filter.

Any ideas are welcome.



Generated Image Alt-Text
[edited by: RWS Community AI at 11:02 AM (GMT 0) on 13 Nov 2024]
emoji
Parents
  •  

    Any ideas are welcome.

    Here's a crazy idea.  You can create a regex for the entire DNT list really easily with a bit of search and replace or a script of some sort.  I used Python to get this as I wanted to handle special chars as well:

    ^#$|^\#contact\-form$|^\#fffffff$|^_blank$|^_self$|^\+359\ 700\ 11\ 502$|^10xp$|^1px\ 1px\ 0\ rgba\(255,255,255,\.5\)$|^1px\ 1px\ 50px\ rgba\(0,0,0,\.4\)$|^advantages\-section$|^after\-title$|^AIzaSyD9TqTOMRLgyslCtiheog1Dy\-Rx2\-0iLzI$|^all$|^arial$|^auto$|^before$|^bg$|^border$|^border2$|^bottom\-left$|^bottom\-right$|^BOUNCE$|^btn\-fullcolor$|^btn\-fullcolor\ btn\-custom\-color$|^btn\-halfwidth$|^btn\-lined$|^btn\-lined\ btn\-custom\-color$|^btn\-lined\ lined\-full\-light$|^btn\-md$|^btn\-primary$|^btn\-\-rounded$|^btn\-third$|^center$|^col\-lg\-4$|^col\-lg\-offset\-0$|^col\-lg\-offset\-3$|^col\-md\-10$|^col\-md\-12$|^col\-md\-2$|^col\-md\-4$|^col\-md\-6$|^col\-md\-8$|^col\-sm\-12$|^container$|^cover$|^custom$|^dark$|^default$|^dynamic$|^eluid022df3e9$|^eluid04c5aec0$|^eluid077d88d4$|^eluid0a166025$|^eluid0c00908f$|^eluid0f98263b$|^eluid15027107$|^eluid156e7b23$|^eluid15bd14f6$|^eluid16bea07d$|^eluid19f5d0f0$|^eluid1a3765be$|^eluid1b031a5c$|^eluid1b68f19d$|^eluid1ca49326$|^eluid2131052e$|^eluid22688afa$|^eluid2335a714$|^eluid23653496$|^eluid25b30795$|^eluid292fb56b$|^eluid299285c0$|^eluid2a190a71$|^eluid2ab6552d$|^eluid2af43c66$|^eluid2d00695d$|^eluid2d395104$|^eluid2e16bce3$|^eluid378727a2$|^eluid38836e29$|^eluid39a4bcf6$|^eluid39e692b5$|^eluid3a1fcd02$|^eluid3bb8c13c$|^eluid3bea40f9$|^eluid3ed8020d$|^eluid3f9972da$|^eluid3ff03ed5$|^eluid47866c9c$|^eluid4827b2e6$|^eluid49385d95$|^eluid4a2effdd$|^eluid4a675b6c$|^eluid4c04cefc$|^eluid4c342995$|^eluid511711a9$|^eluid51372e49$|^eluid51ecc613$|^eluid5517f149$|^eluid5634d526$|^eluid563de37c$|^eluid56c6d6d5$|^eluid572d7987$|^eluid5787df79$|^eluid582b9cc3$|^eluid58b70d39$|^eluid5da1a6a5$|^eluid5f51c6fa$|^eluid5f58cddb$|^eluid63ee6290$|^eluid66c2941c$|^eluid6751ed77$|^eluid6799ae03$|^eluid6a112b8e$|^eluid6b8ed78c$|^eluid6d6aa085$|^eluid6e5deeaa$|^eluid6ea6821a$|^eluid6ef7509d$|^eluid6f9b2655$|^eluid6ff533e5$|^eluid70cde5fa$|^eluid73733366$|^eluid75a64a89$|^eluid76444380$|^eluid77e9518e$|^eluid78387f20$|^eluid7ddb7447$|^eluid82e21f98$|^eluid82ed341d$|^eluid843248f0$|^eluid8487535f$|^eluid856a80b7$|^eluid87efbeff$|^eluid88f509af$|^eluid8956f512$|^eluid8a17e471$|^eluid8c6ba42c$|^eluid8d8cddec$|^eluid8e43ce0f$|^eluid8f9e1ebe$|^eluid9228084a$|^eluid924f7256$|^eluid93cea83e$|^eluid960b7d87$|^eluid965823ac$|^eluid9816d84b$|^eluid98b14bb4$|^eluid9941b5e6$|^eluid9a9b3cd2$|^eluid9b6f0c68$|^eluid9c363cce$|^eluid9c571245$|^eluid9cf90f5a$|^eluid9d1dec19$|^eluid9ff2bc13$|^eluida17b8c08$|^eluida3a76d77$|^eluida4a0afe1$|^eluida5b5da44$|^eluida9e80346$|^eluidaa608885$|^eluidaa7a116b$|^eluidab142c57$|^eluidada689fd$|^eluidadf62c90$|^eluidae73a497$|^eluidafbf0d0a$|^eluidafc9e1c0$|^eluidb051f74e$|^eluidb1eaeb28$|^eluidb413df32$|^eluidb602d894$|^eluidb694af38$|^eluidb7882889$|^eluidb7c695b3$|^eluidb800e051$|^eluidb8c6bf53$|^eluidb91bc990$|^eluidbaddaecd$|^eluidbbd74bd0$|^eluidbc157a7b$|^eluidbc180a58$|^eluidbcc31f31$|^eluidbfda9919$|^eluidc0e39f82$|^eluidc2965712$|^eluidc5134011$|^eluidc70f5449$|^eluidc99abfbc$|^eluidca7f53c1$|^eluidcbfffe79$|^eluidd2a0b580$|^eluidd97b39db$|^eluide2511b40$|^eluide385f8e4$|^eluide772b851$|^eluidea2ce041$|^eluideaecba6b$|^eluidec5ad4e9$|^eluided2408ae$|^eluidef211cb6$|^eluidf0479c1a$|^eluidf1e1f7be$|^eluidfbe5d907$|^eluidfc024ba3$|^eluidfc1bf4c6$|^eluidfd69f1c1$|^eluidfd6eac5d$|^eluidffde714a$|^fancy$|^fixed$|^Flaticon$|^full_width$|^glyphicons_halflingsregular$|^gradient$|^grid\-ibx\-\-hover\-bg$|^gutter\-lg$|^h3$|^h4$|^helvetica$|^home$|^hover$|^hover\-box$|^oltrans\.bg/\.\.\./Ekip2024\.jpg$|^oltrans\.bg/\.\.\./18\-years\.png$|^g\.page/\.\.\./review$|^oltrans\.bg/\.\.\./Plovdiv\-4optimized\-1200x800\-optimized\.jpg$|^oltrans\.bg/\.\.\./monument\-2013682_1280\.jpg$|^oltrans\.bg/\.\.\./plovdiv\-1613984_1280\.jpg$|^oltrans\.bg/\.\.\./plovdiv\-2030532_1280\.jpg$|^oltrans\.bg/\.\.\./sunset\-3218147_1280\.jpg$|^oltrans\.bg/\.\.\./the\-old\-town\-670457_1280\.jpg$|^oltrans\.bg/\.\.\./calligraphy\-2658504_1200x500\.jpg$|^oltrans\.bg/\.\.\./Rimski\-stadion\.jpg$|^oltrans\.bg/\.\.\./elia\.png$|^oltrans\.bg/\.\.\./iso\.png$|^oltrans\.bg/\.\.\./Background\-light\.jpg$|^oltrans\.bg/\.\.\./kti\-logo\-dark\.png$|^oltrans\.bg/\.\.\./Machine\-translation\-2\.png$|^oltrans\.bg/\.\.\./Obiknoven\-prevod\-1\.png$|^oltrans\.bg/\.\.\./profesionalen\-prevod\-1\.png$|^oltrans\.bg/\.\.\./Specialised\-file\-format\-1200h628\.jpg$|^oltrans\.bg/\.\.\./ssm\-logo0x0\.png$|^icon$|^icontitle$|^image$|^img$|^imgboxes_style1$|^info@sotirr\.sg\-host\.com$|^infobox$|^inline_left$|^is_email$|^is_numeric$|^kl\-social\-icons$|^large$|^left$|^lg$|^light$|^linear$|^mask3$|^mask4\ mask4l$|^mask5$|^masonry$|^md$|^min\-height$|^no$|^noleftpadding$|^none$|^no\-repeat$|^norightpadding$|^normal$|^not_empty$|^pixel$|^Power1\.easeOut$|^px$|^resp$|^right$|^ROADMAP$|^scroll$|^select$|^short$|^solid$|^Statistics$|^style1$|^style2$|^style3$|^text$|^textarea$|^tgg$|^TH_Accordion$|^TH_Buttons$|^TH_CallOutBanner$|^TH_CircleTitleTextBox$|^TH_CustomSubHeaderLayout$|^TH_GridPhotoGallery$|^TH_HoverBox$|^TH_IconBox$|^TH_IconBoxesGrid$|^TH_ImageBox$|^TH_InfoBox2$|^TH_Skills$|^TH_SpacerElement$|^TH_Statistics$|^TH_StepsBox2$|^TH_StepsBox4$|^TH_TeamBox$|^TH_TextBox$|^TH_TitleElement$|^theme$|^title_style_center$|^top$|^topright$|^trebuchet$|^u2709$|^ue008$|^ue013$|^ue022$|^ue041$|^ue055$|^ue062$|^ue065$|^ue177$|^ue178$|^ue182$|^ue224$|^ue236$|^ue814$|^ue836$|^uf189$|^verdana$|^xs$|^yes$|^yy\-mm\-dd$|^zn_def_header_style$|^zn_dummy_value$|^zn_fill_class$|^ZnAnchorPoint$|^ZNB_Button$|^ZnColumn$|^ZnContactForm$|^ZnGoogleMap$|^ZnSection$

    Put that into the advanced display filter to filter on these strings in your file, and then copy source to target and lock them.  Then reverse the filter to leave only the bits you need to translate.

    I'll be honest and note I didn't test this as I'm not on a laptop with Studio right now but I'm fairly sure it'll work :-)

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
  •  

    Here's the Python script in case it's helpful:

    import re
    
    # Set the absolute path to the text file containing the patterns
    file_path = r"c:\Users\paul\Documents\Production Scripts\Python\Wrapping_Regex\patterns.txt"
    
    try:
        # Read patterns from the text file
        with open(file_path, 'r') as file:
            # Strip whitespace and skip empty lines
            patterns = [line.strip() for line in file if line.strip()]
    
        # Escape each pattern, add anchors, and join with OR '|'
        regex_pattern = "|".join([f"^{re.escape(pattern)}$" for pattern in patterns])
    
        # Display the final regex pattern
        print("Generated regex pattern:\n", regex_pattern)
        
    except FileNotFoundError:
        print(f"File not found: {file_path}")
    except Exception as e:
        print(f"An error occurred: {e}")
    

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
Reply
  •  

    Here's the Python script in case it's helpful:

    import re
    
    # Set the absolute path to the text file containing the patterns
    file_path = r"c:\Users\paul\Documents\Production Scripts\Python\Wrapping_Regex\patterns.txt"
    
    try:
        # Read patterns from the text file
        with open(file_path, 'r') as file:
            # Strip whitespace and skip empty lines
            patterns = [line.strip() for line in file if line.strip()]
    
        # Escape each pattern, add anchors, and join with OR '|'
        regex_pattern = "|".join([f"^{re.escape(pattern)}$" for pattern in patterns])
    
        # Display the final regex pattern
        print("Generated regex pattern:\n", regex_pattern)
        
    except FileNotFoundError:
        print(f"File not found: {file_path}")
    except Exception as e:
        print(f"An error occurred: {e}")
    

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
Children
No Data