Translations fallback mechanism, by highest priority

1- Database

Translations are saved in translation table.
They are added using Inline translation feature or can be added manually.
Magento will load translations for the current locale

2- Themes

Translations are located in app/design/i18n folder.
Magento will merge all translations files found in the current theme and his parents for the current locale.

3- Language packages

Translations are located in app/i18n/[Vendor_Name]/xx_yy folder.
Magento will merge all installed language packages for the current locale.

4- Module

Translations are located in app/code/[Vendor_Name]/[Module_Name]/i18n folder.

Initialization

Magento\Framework\App\Area->_initTranslate()
Magento\Framework\App\Area->loadData()

List all modules.
For each modules check if i18n/xx_YY.csv exists and add data to \Magento\Framework\Translate::_data



Load and merge all phrases from language packs by locale (en_US, en_CA, fr_FR, fr_CA etc…).
If language pack is the same as the current local then add data to \Magento\Framework\Translate::_data



Load and merge all phrases from themes by locale
Check if i18n/xx_YY.csv exists and add data to \Magento\Framework\Translate::_data



Load all phrases from database for the current locale