Open verhovsky opened 1 month ago
As mentioned towards the end of https://github.com/bryceco/GoMap/issues/742 we don't have an easy way to do this currently, because there's no way in Xcode to mark a string as not needing localization. And as far as I'm aware there's no way to mark a string in XLIFF as read-only. The current approach is to do a bulk-edit of the Weblate database adding flag:read-only to strings with note:"Placeholder - Do not translate"
I guess a better solution is to have a script that runs after exporting XLIFFs that searches each one for the "Placeholder" text and then deletes the surrounding string.
I tried to fix it using the script below. Unfortunately it breaks things:
"
	
gets changed to a tab character.#!/usr/bin/python3
# Look though an xliff file and delete translation units that contain Note = Placholder
import sys, os
from xml.dom.minidom import parse
filename = sys.argv[1]
document = parse(filename)
tag = "Note = \"Placeholder -".lower()
# print(tag)
notes = document.getElementsByTagName("note")
for note in notes:
child = note.firstChild
if child != None:
value = child.nodeValue
if tag in value.lower():
# print(value)
# Remove the parent
transUnit = note.parentNode
body = transUnit.parentNode
body.removeChild(transUnit)
print(document.toprettyxml(indent=" ",newl=""))
There are a bunch of strings on Weblate that say "Note = "Placeholder - Do not translate";", for example
Base.lproj/MainStoryboard.storyboard///1tR-eI-DSh.configuration.title
. Please remove them so I don't have to click past them to check for new things to translate and so that 100% translated will actually mean 100% translated.