How to i18n text coming from the db or from an external source

Short answer: You don’t. Not with the I18N functions. Data in the database is data that can change, and should be translated via some separate means. Data in the code is hard-coded, and doesn’t change, and can be translated via the I18N functions.

If you want to store all your translatable text in a single PHP file as an array, and then reference it from elsewhere in the code, then that works fine.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)