puppetlabs / puppet-specifications

Specification of the Puppet Language, Catalog, Extension points
Other
99 stars 66 forks source link

(PUP-6934) Update file path specification to include locale directories #91

Closed Magisus closed 7 years ago

Magisus commented 7 years ago

This adds a specification for the location of translation files for use with gettext, both on Unix and on Windows.

This PR is in part a request for comment: do these seem like the correct directories for PO files?

glennsarti commented 7 years ago

👍 for merge from me

Magisus commented 7 years ago

Some context from further research:

Unless I'm mistaken, it looks like the C++ tooling is going to require a specific directory structure (see http://www.boost.org/doc/libs/1_62_0/libs/locale/doc/html/messages_formatting.html#msg_loading_dictionaries). Do we want this to affect the way we structure things for Ruby at all? Alternatively, am I missing something about our C++ process that makes this irrelevant? /cc @MikaelSmith

Magisus commented 7 years ago

Updated this to use something more standard on Unix:

/opt/puppetlabs/puppet/share/locale/<lang_COUNTRY>/LC_MESSAGES/<project>.mo

<project> refers to each of Facter, Puppet, Heira, etc. This path assumes that all PO files are compiled to binary MO files before installation, including for Ruby projects, where that step is technically optional.

Magisus commented 7 years ago

If we want to use the Unix standard path structure described above, we will have to make changes to the gettext-setup gem, because it is currently hard-coded to use PO files, and therefore will not correctly parse the proposed subdirectories. I am happy to refactor the gem if that seems reasonable to achieve a common directory structure between projects.

Update: proposed refactor of gettext-setup gem -> https://github.com/Magisus/gettext-setup-gem/commit/0d0d254646841e5cb054a986e34d902a72bd207f

MikaelSmith commented 7 years ago

I'm not tied to .po vs .mo, I think we could say both and leave it up to each project which they use.

Overriding the C++ tooling (which requires <lang_COUNTRY>/LC_MESSAGES/<project>.mo) would be hard.

Magisus commented 7 years ago

I am personally in favor of consistency across projects. Researching how these files are stored in general was very difficult because there seems to be no agreed-upon way to do it. I'd rather we didn't replicate that problem internally, at least not within the puppet-agent package. So unless there is a good, specific reason to use PO files over MO files for Ruby, I think we should lay down the directory structure for MO and then use it everywhere. And because that format is required for the C++ projects, we will have to write out automation for compiling the PO files anyway.

Iristyle commented 7 years ago

In agreement that .mo looks to be the way to go.

geoffnichols commented 7 years ago

👍

Magisus commented 7 years ago

@Iristyle did you have any further comments on this? I have verified that these paths can be correctly installed to and read from, on both Linux and Windows.

Iristyle commented 7 years ago

Sorry, I was good with this as well. 👍