If you write your own stuff, you'll have to put it into the localization loading mechanism recognized by the programming language/library you use or check the appropriate environment variables for yourself. If you just like to add some messages to an existing application, there's usally a file to put your new stuff into, because the loading mechanism is already done by someone.
The Linux libc has some -predefined mechanisms to act upon the LANG & LC_MESSAGES settings (LC_CYTPE, LC_ALL, LC_MONEY, LC_YOUNAMEIT...), but in other programming languages you might to it by yourself.
Here's a detailed example how to do it in Gtk:
But it really depends on wether your application is pure C with localization via Linux' libc or a Gtk app or some KDE stuff or written in Java...
And not every application running under Linux is necessarily localized.