wearerequired / traduttore

🗼 A WordPress plugin to improve the I18N workflow for your own projects based on @GlotPress.
https://wearerequired.github.io/traduttore/
72 stars 15 forks source link

Use text domain for translation file names #103

Closed swissspidy closed 5 years ago

swissspidy commented 5 years ago

Issue Overview As reported in #100, Traduttore creates translation files with names like <project-slug>.mo.

The project slug in GlotPress and the actual slug of the WordPress plugin or theme can be different.

So if your GlotPress project's slug is example-corp/example-plugin, but the plugin's actual slug (and thus text domain) is just example, Traduttore creates example-plugin.mo while WordPress is looking for example.mo.

As suggested in https://github.com/wearerequired/traduttore/pull/100#issuecomment-437057906 we should determine the text domain upon POT file generation / translation import and save that information in the database.

After that, when generating the language packs we use that text domain for the file names.

Additional context

100.

swissspidy commented 5 years ago

Looks like #107 uses the project's text domain for the file name but omits the locale in the process 🤦‍♂️

Will look into this as part of #108.

ocean90 commented 5 years ago

Do you think it's possible to fix this also without #108? It's a bit unfortunate for users who are using the current master branch as it generates broken language packs.