[wp-hackers] Will automatic translation files updates overwrite user's modifications

Dion Hulse (dd32) wordpress at dd32.id.au
Wed Dec 4 00:28:56 UTC 2013


It may be worth checking out what our POMO class allows though, you may
find it's possible for it to load multiple files into the same text domain
(or at least, it might be easy to allow that to happen).

WordPress by default only loads one file per language + text domain though.

WordPress will [eventually] automatically update any language files in
WP_LANG_DIR/(plugins|themes)/$plugin-$lang.(mo|po), so if you store your
custom files in WP_LANG_DIR/custom-plugins/, or
WP_PLUGIN_DIR/plugin-slug/my-translations/$plugin-$lang.(mo|po) you'll be
fine.


On 4 December 2013 09:21, Justas Butkus <jbutkus at time.ly> wrote:

> You would have to manually create merge product. You may use msgmerge[1]
> or similar command to accomplish this. I am not sure if there is some PHP
> implementation of this.
>
> Translation files themselves are not meant to be extended, unlike classes
> in object oriented programming.
>
>
> [1]: http://www.gnu.org/software/gettext/manual/html_node/
> msgmerge-Invocation.html
>
>
> --
> Regards,
> Justas Butkus
>
> 2013.12.03 21:39, Nikola Nikolov rašė:
>
>  Okay, so do you know if it's possible to have "overriding" of translations
>> that would work like extending a class in PHP. So - you would have your
>> custom translation file that will only overwrite a couple of the
>> translation strings. Everything else would come from the original
>> translation file.
>>
>> Also are you aware of any plugins that can do that at the moment? Or is
>> that even possible filter-wise.
>>
>>
>> On Tue, Dec 3, 2013 at 9:25 PM, Otto <otto at ottodestruct.com> wrote:
>>
>>  If the files are being stored in a place that WordPress is expecting to
>>> be
>>> able to update them, then yes. It's no different than changing core code
>>> or
>>> changing code in a plugin or theme directly.
>>>
>>> If you use customized files, then you should put them in custom locations
>>> with some form of custom code to cause the system to use them. Modifying
>>> files that can be updated by an auto-update process directly means your
>>> changes are not safe.
>>>
>>>
>>>
>>>
>>> -Otto
>>>
>>>
>>> On Tue, Dec 3, 2013 at 1:03 PM, Nikola Nikolov <nikolov.tmw at gmail.com
>>>
>>>> wrote:
>>>> It just occurred to me - the new feature(automatic download/update of
>>>> translation files) that is planned for WordPress is awesome, but would
>>>> it
>>>> overwrite any changes the user might have done to the local translation
>>>> file?
>>>>
>>>> For instance, the user has installed the Codestyling Localization
>>>> plugin,
>>>> or has a different way of overwriting translation files and has modified
>>>> one or more translation files.
>>>>
>>>> Why would they do that? Well they just don't like the wording for
>>>>
>>> instance
>>>
>>>> - translation files are a great way to tweak texts(even when the
>>>> original
>>>> text is in the same language), without having to modify the code.
>>>>
>>>> So what I'm wondering is - are those edits going to be lost upon update
>>>>
>>> or
>>>
>>>> are they going to be preserved? It's true that if it's the translation
>>>>
>>> file
>>>
>>>> of a theme or a plugin that they changed, upon updating those the edits
>>>> would be lost, but does the same apply for WordPress translation
>>>> files(stored in /wp-content/languages/)?
>>>>
>>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list