Q:

Deploying localization files for Geoprocessing service in ArcGIS Server

I have a Python geoprocessing tool, it is split in several Python files, When I use  ArcGIS Pro to publish it as a service into the ArcGIS Server, all the dependencies are packed and deployed to the service.
Now the tool is internationalized and localized using gettext and have the following structure:
./Alignment.py    
./locale/Spanish/LC_MESSAGES/Alignment.mo
./locale/Spanish/LC_MESSAGES/Alignment.po
./locale/German/LC_MESSAGES/Alignment.mo
./locale/German/LC_MESSAGES/Alignment.po

The Python files are deployed but neither *.mo nor *.po files are deployed.
How can I make that those files are included in the set of files deployed to the ArcGIS Server?
[UPDATE]
If In the file Alignment.py I make a horrible hack like this i:
locale_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "locale/Spanish/LC_MESSAGES/")

the folder and its content are added to the service, but the folder structure changes a lot:
MyService.sd
 |-p20
     |-Service
     |   |-Alignment.py
     |
     |-lc_messages
        |-Alignment.mo
        |-Alignment.po

A:

Take a look at the Authoring Geoprocessing Services with Python help, specifically the section on Importing other modules. This is essentially the same scenario you're working on.
You've got everything in a folder(s). You'll want to make a variable in your script that points to these folders. I'd suggest writing the full path to the folder in your script (c:/locale/spanish/...), not the relative path. During the publishing process, as long as the variable (folder its pointing at) is NOT referenced in the data store, the folder and it's contents will be copied. The hard path you have in your script (c:/locale/spanish/..) will be updated to the hardpath on the server where the folder is copied too.

