Enjoy.
Sub
AndroidStringsToIOSLocalizable()
DTE.ActiveDocument.Selection.PageUp(False,
99) DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
DTE.ExecuteCommand("Edit.Find")
DTE.Find.FindWhat = "<?"
DTE.Find.Target =
vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.Backwards = False
DTE.Find.MatchInHiddenText =
False
DTE.Find.PatternSyntax =
vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.Action =
vsFindAction.vsFindActionFind
If
(DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw New System.Exception("vsFindResultNotFound")
End
If
DTE.ActiveDocument.Selection.EndOfLine(True)
DTE.ActiveDocument.Selection.Delete(2)
DTE.ExecuteCommand("Edit.Find")
DTE.Find.FindWhat = "<resources>"
DTE.Find.Target =
vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.Backwards = False
DTE.Find.MatchInHiddenText =
False
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.Action =
vsFindAction.vsFindActionFind
If
(DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw
New System.Exception("vsFindResultNotFound")
End
If
DTE.ActiveDocument.Selection.EndOfLine(True)
DTE.ActiveDocument.Selection.Delete(2)
DTE.ExecuteCommand("Edit.Replace")
DTE.Find.Action =
vsFindAction.vsFindActionReplaceAll
DTE.Find.FindWhat = "<string name="
DTE.Find.ReplaceWith = ""
DTE.Find.Target =
vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText =
False
DTE.Find.PatternSyntax =
vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.ResultsLocation =
vsFindResultsLocation.vsFindResultsNone
If
(DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw
New System.Exception("vsFindResultNotFound")
End If
DTE.Find.FindWhat = "</string>"
DTE.Find.ReplaceWith = """;"
If
(DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw
New System.Exception("vsFindResultNotFound")
End
If
DTE.ExecuteCommand("Edit.Replace")
DTE.Find.FindWhat = """>"
DTE.Find.ReplaceWith = """ = """
DTE.Find.Target =
vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText =
False
DTE.Find.PatternSyntax =
vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.ResultsLocation =
vsFindResultsLocation.vsFindResultsNone
DTE.Find.Action =
vsFindAction.vsFindActionReplaceAll
If
(DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw
New System.Exception("vsFindResultNotFound")
End
If
DTE.ExecuteCommand("Edit.Replace")
DTE.Find.FindWhat = "<!--"
DTE.Find.ReplaceWith = "/* "
DTE.Find.Target =
vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText =
False
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.ResultsLocation =
vsFindResultsLocation.vsFindResultsNone
DTE.Find.Action =
vsFindAction.vsFindActionReplaceAll
If
(DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw
New System.Exception("vsFindResultNotFound")
End
If
DTE.ExecuteCommand("Edit.Replace")
DTE.Find.FindWhat = "-->"
DTE.Find.ReplaceWith = "= */"
DTE.Find.Target =
vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText =
False
DTE.Find.PatternSyntax =
vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.ResultsLocation =
vsFindResultsLocation.vsFindResultsNone
DTE.Find.Action =
vsFindAction.vsFindActionReplaceAll
If
(DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw
New System.Exception("vsFindResultNotFound")
End
If
DTE.ExecuteCommand("Edit.Find")
DTE.Find.FindWhat = "</re"
DTE.Find.Action =
vsFindAction.vsFindActionFind
DTE.Find.Target =
vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.Backwards = False
DTE.Find.MatchInHiddenText =
False
DTE.Find.PatternSyntax =
vsFindPatternSyntax.vsFindPatternSyntaxLiteral
If
(DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw New System.Exception("vsFindResultNotFound")
End
If
DTE.ActiveDocument.Selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
DTE.ActiveDocument.Selection.EndOfLine(True)
DTE.ActiveDocument.Selection.DeleteLeft(2)
DTE.ActiveDocument.Save("Localizable.strings")
DTE.ActiveWindow.Close(vsSaveChanges.vsSaveChangesNo)
End
Sub
1 comment:
Hello! If you ever need a reliable translation platform to easier manage your app localization, I recommend to have a look at https://poeditor.com/. It is a web localization tool with a friendly interface, created to simplify users' workflow. See if it helps.
Post a Comment