Discussion:
Will automatic translation files updates overwrite user's modifications
Nikola Nikolov
2013-12-03 19:03:18 UTC
Permalink
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/)?
Otto
2013-12-03 19:25:16 UTC
Permalink
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
Post by Nikola Nikolov
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
http://lists.automattic.com/mailman/listinfo/wp-hackers
Nikola Nikolov
2013-12-03 19:39:02 UTC
Permalink
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.
Post by Otto
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
Post by Nikola Nikolov
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
Post by Nikola Nikolov
- 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
Post by Nikola Nikolov
are they going to be preserved? It's true that if it's the translation
file
Post by Nikola Nikolov
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
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Justas Butkus
2013-12-03 22:21:52 UTC
Permalink
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
Post by Nikola Nikolov
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.
Post by Otto
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
Post by Nikola Nikolov
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
Post by Nikola Nikolov
- 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
Post by Nikola Nikolov
are they going to be preserved? It's true that if it's the translation
file
Post by Nikola Nikolov
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/)?
Dion Hulse (dd32)
2013-12-04 00:28:56 UTC
Permalink
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.
Post by Justas Butkus
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
Okay, so do you know if it's possible to have "overriding" of translations
Post by Nikola Nikolov
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.
If the files are being stored in a place that WordPress is expecting to
Post by Otto
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
Post by Nikola Nikolov
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
Post by Nikola Nikolov
- 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
Post by Nikola Nikolov
are they going to be preserved? It's true that if it's the translation
file
Post by Nikola Nikolov
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
http://lists.automattic.com/mailman/listinfo/wp-hackers
Xavier Faraudo i Gener
2013-12-04 11:36:02 UTC
Permalink
Post by Otto
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.
Wouldn't just something like:

add_filter( 'auto_update_translation', '__return_false' );

do the trick of avoiding auto-update on translations?

I mean, you do normally know when you're using custom translations, and
adding this filter is trivial (it's custom code that looks easier than
using custom loading code, and user-unfriendly custom locations).

Maybe the only issue is *when* should it be added, but so far it worked
for me hooking it at init.


Cheers

Xavier
Nikola Nikolov
2013-12-04 13:36:44 UTC
Permalink
That is also an option, but when I have some free time on my hands some day
I might look into the more complicated way.
Simply because if you don't get any updates on your custom translation
files, then you would have missing translations as well - and merging the
default with your custom translations manually would eventually get time
consuming.


On Wed, Dec 4, 2013 at 1:36 PM, Xavier Faraudo i Gener <
Post by Otto
If the files are being stored in a place that WordPress is expecting to be
Post by Otto
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.
add_filter( 'auto_update_translation', '__return_false' );
do the trick of avoiding auto-update on translations?
I mean, you do normally know when you're using custom translations, and
adding this filter is trivial (it's custom code that looks easier than
using custom loading code, and user-unfriendly custom locations).
Maybe the only issue is *when* should it be added, but so far it worked
for me hooking it at init.
Cheers
Xavier
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Xavier Faraudo i Gener
2013-12-04 13:49:50 UTC
Permalink
Post by Nikola Nikolov
That is also an option, but when I have some free time on my hands some day
I might look into the more complicated way.
Simply because if you don't get any updates on your custom translation
files, then you would have missing translations as well - and merging the
default with your custom translations manually would eventually get time
consuming.
Well, this only disables *automatic* translations. You can always check
them manually from the update panel, AFAIK. (May be wrong in this).
Meaning that you can manually update the non-custom files in the good
ol' way of clicking a link to update.

Merging custom and official (rather than "default", which is a text
domain) may not be that time-consuming. You can add any number of
translation files to a domain (they're just keys of the global array
l10n, after all). And the way that the gettext implementation merges
entries/files/domains is basically "if it exists, do nothing" (not true
for the loaded comments, though, but developer comments are basically
unused, and highly useless once strings are translated). So, you'd only
need to make sure your translation files are loaded before any other if
you want to go this way…

I'm not sure if I follow you at all, though. I mean, you'd have missing
translations as long as the source files are changed and you don't
update your custom files, right? So you need to update your *custom
translations* anyway, which is not that time-consuming (unless the
source files are highly changed, that is).
Post by Nikola Nikolov
On Wed, Dec 4, 2013 at 1:36 PM, Xavier Faraudo i Gener <
Post by Otto
If the files are being stored in a place that WordPress is expecting to be
Post by Otto
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.
add_filter( 'auto_update_translation', '__return_false' );
do the trick of avoiding auto-update on translations?
I mean, you do normally know when you're using custom translations, and
adding this filter is trivial (it's custom code that looks easier than
using custom loading code, and user-unfriendly custom locations).
Maybe the only issue is *when* should it be added, but so far it worked
for me hooking it at init.
Cheers
Xavier
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
-----
No se encontraron virus en este mensaje.
Comprobado por AVG - www.avg.com
Version: 2014.0.4259 / Base de datos de virus: 3657/6890 - Fecha de publicacion: 12/04/13
--
Xavier Faraudo i Gener (the WordPress Web Warlock)
Loading...