Here are the lessons that I learned while performing the translation to Spanish for The Bed Brigade National website. I created documentation specific for our project.
- If you have a brownfield project, you have to find all of the strings that need to be localized in your Razor files. I ended up creating logic to do this.
- You have to localize any validation messages. I still wanted to use DataAttributes for validation so I ended up writing some custom code to pull out the validation messages and then more custom logic to actually do the validation and get the translation.
- The need to do partial translations. Sometimes dropdown lists, enums, or other dynamic content can be partially translated. I created code to do this.
- Content Management System translations. We are seeding our whole site so that when you run it locally or you deploy it to a new environment you have data to work with. So the content can be pre-translated. However once the user changes words on the page, we need to check if we can translated it using what we have already translated, if not we need to queue it for translation.
- Translators cannot handle weird line feeds in the middle of your content. I like to format my HTML before I save it and this does not affect the browser rendering at all. However the language translators have no idea what you are doing and will return back strange translations. So you have to replace all tabs, and line feeds with spaces.
- There is one free translator available. It is slow but it works.
- Microsoft Translator https://www.microsoft.com/en-us/translator/business/translator-api/
- AWS Translate https://aws.amazon.com/translate/
- IBM Cloud API Language Translator https://www.ibm.com/cloud/watson-language-translator
- Translate.com https://www.translate.com/translation-api
- Systran Translate API https://docs.systran.net/translateAPI/
- Google translate https://cloud.google.com/translate/docs/reference/rest
- Libre Translate https://libretranslate.com/