If you are already using Closed Captioning for your subtitles, you have a few different options.
If your video is hosted on a platform that provides it, like YouTube, your English captions can be automatically translated based on the *viewers* choice. From Settings (the gear menu at the bottom of the video) there is a subtitles option. From there, the user can elect to "Autotranslate" which will convert whatever original language the captions are in to one of the viewers choice.
If you have to manually translate your captions, I recommend changing the captions to SRT format. When you export your video, go to the Roles section and turn on "Export each SRT language as a separate file" (but don't turn on the "Include text formatting" option).
I would recommend opening the SRT file in BBEdit (there's a free version) and use it to strip out the XML font-color tags with this regular expression Find and Replace:
Find:
<font.*\>(.*|.*\r.*)<\/font>
Replace
\1
Then copy the SRT contents and go to https://translate.google.com and paste the contents in the translator. Set the Translation language to Spanish and copy and paste the SRT to a new document.
You should be able to go into FCP and go to File > Import > Captions and import the Spanish translation captions. [I'm not an expert on this!!!]
You have the option to "Burn In" captioning from the Share/Export dialog (again in the Roles section.)
IF your subtitles are actual Titles (like Basic Title)... I built an extractor that will pull all the Title texts from a project and create a text file. All the Titles texts will be numbered and the output looks something like:
1:
HUD Creation Tool builds masks with sci-fi borders
2:
The “basic” mask
3:
The Border Offset allows you to “displace” the border from the mask edge! Experiment!
4:
The Corners
5:
The Indents
6:
All you need to do is go to File > Export XML and save the project XML to your hard drive. In the Extractor, you click the Browse button and find the XML then click the Upload button. It's very easy to use.
You can take the resultant text file (or just copy it from the webpage textarea) to the translator, then duplicate your titles and reload the texts (you should be able to simply copy/paste the translations in place). Turning off the visibility of (the English) titles is easy - just select the title and type the V key to toggle its visibility.
The extractor is here:
https://fcpxtemplates.com/fcp-titles-text-extractor/
It's free to use and no data you upload to the webpage is saved to the site - it only exists while you are actively using the webpage and the file uploaded is immediately deleted from the server.
HTH