Overriding lang files

Hi!
I have question about overriding lang files. I mean plugin’s lang files.
For example we created plugin with lang file ecatalogue_ru.php.
When we install it on web site, almost always we override lang file by copying it from plugins/ecatalogue/lang/ecatalogue_ru.php to sqluelettes/lang/ecatalogue_ru.php.
We do some changes in it and everything works fine.
But the problem is when we update our plugin and add new items to lang file. As a result, SPIP continues using our lang file in squelettes, and doesn’t see new items.
So I wonder if there is possibility to combine items from two files. I mean to make SPIP take all items from overrided file from squelettes/lang and then take missing items from plugins/ecatalogue/lang?

And also I have another interesting question. Is there any plugin that allows us to edit lang items of plugins from admin page?
I know about plugin « Items & Traductions ». But as I know it is a little out of date and doesn’t allow to work with plugin’s lang files. And also it has some problems and errors.
For needs of our company we fixed this plugin to work properly with SPIP 2.x. I wonder if anyone is using this plugin and whether should we commit this our version to repository or not?

Thanks in advance.

On 20/04/2012 9:52, Алексей Ярощук wrote:

I have question about overriding lang files. I mean plugin's lang files.
For example we created plugin with lang file ecatalogue_ru.php.
When we install it on web site, almost always we override lang file by
copying it from plugins/ecatalogue/lang/ecatalogue_ru.php to
sqluelettes/lang/ecatalogue_ru.php.

I believe you could also override with a squelettes/local_ru.php language file.

We do some changes in it and everything works fine.
But the problem is when we update our plugin and add new items to lang
file. As a result, SPIP continues using our lang file in squelettes, and
doesn't see new items.

Yes that's the probleme when you override with copies. Try local_ru.php , it has the priority over other languages files.

*So I wonder if there is possibility to combine items from two files. I
mean to make SPIP take all items from overrided file from
squelettes/lang and then take missing items from plugins/ecatalogue/lang?*

Not at this time but, with local_ru.php you don't really need it anymore

And also I have another interesting question. *Is there any plugin that
allows us to edit lang items of plugins from admin page? *
I know about plugin "Items & Traductions". But as I know it is a little
out of date and doesn't allow to work with plugin's lang files. And also
it has some problems and errors.
For needs of our company we fixed this plugin to work properly with SPIP
2.x. I wonder if anyone is using this plugin and whether should we
commit this our version to repository or not?

The "SPIP-zone" is open to contributors !

Inscription:
- go to http://listes.rezo.net/mailman/listinfo/spip-zone and write in
- send then an e-mail to the list describing your project and asking for codes to write to the svn repository
- There is a non translated "charte": the global meaning is "the zone is for GPL projects and collaborative developpments". Of course, debugging an old unmaintained plugin is a good project.

Friendly,

--
Suske

Hi,

Maybe you do not use the lang items.
if your templates use <:ecatalogue:lang_item:>, they will call the element defined in plugins/ecatalogue/lang/plugins/ecatalogue/lang/
ecatalogue_ru.php

Or it should…
But since you have copied this file into squelettes/lang so SPIP never finds the original file.
The problem comes here from the explicit call to a language file ecatalogue_XX.php

You should use squelettes/lang/local_ru.php and insert your lan items with <:lang_item:>
It’s definition is first searched into this user lang file. And if it’s not found SPIP looks at the language files of the plugins.

.Gilles

On Fri, Apr 20, 2012 at 9:52 AM, Алексей Ярощук <a.yaroshuk@aloha.org.ua> wrote:

Hi!
I have question about overriding lang files. I mean plugin’s lang files.
For example we created plugin with lang file ecatalogue_ru.php.
When we install it on web site, almost always we override lang file by copying it from plugins/ecatalogue/lang/ecatalogue_ru.php to sqluelettes/lang/ecatalogue_ru.php.
We do some changes in it and everything works fine.
But the problem is when we update our plugin and add new items to lang file. As a result, SPIP continues using our lang file in squelettes, and doesn’t see new items.
So I wonder if there is possibility to combine items from two files. I mean to make SPIP take all items from overrided file from squelettes/lang and then take missing items from plugins/ecatalogue/lang?

And also I have another interesting question. Is there any plugin that allows us to edit lang items of plugins from admin page?
I know about plugin « Items & Traductions ». But as I know it is a little out of date and doesn’t allow to work with plugin’s lang files. And also it has some problems and errors.
For needs of our company we fixed this plugin to work properly with SPIP 2.x. I wonder if anyone is using this plugin and whether should we commit this our version to repository or not?

Thanks in advance.


spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

On Fri, Apr 20, 2012 at 11:25 AM, Suske <suske@brubel.net> wrote:

And also I have another interesting question. *Is there any plugin that
allows us to edit lang items of plugins from admin page? *

I know about plugin « Items & Traductions ». But as I know it is a little
out of date and doesn’t allow to work with plugin’s lang files. And also
it has some problems and errors.
For needs of our company we fixed this plugin to work properly with SPIP
2.x. I wonder if anyone is using this plugin and whether should we
commit this our version to repository or not?

The « SPIP-zone » is open to contributors !

Inscription:

  • go to http://listes.rezo.net/mailman/listinfo/spip-zone and write in
  • send then an e-mail to the list describing your project and asking for codes to write to the svn repository
  • There is a non translated « charte »: the global meaning is « the zone is for GPL projects and collaborative developpments ». Of course, debugging an old unmaintained plugin is a good project.

You should look at the tool Salvatore that is used to translate the lang files.
If your plugin is local, you have to adapt it a little and it will work like a charm !

If your plugin is on the zone, it may be changed a little to be referenced by the official Salvatore - and then you will be able to translate the plugin with the translation community.

To translate plugins indexed by Salvatore, it’s here : http://trad.spip.org/
The french documentation of Salvator is here : http://trad.spip.org/f-a-q/article/que-fait-salvatore
The global translation status can be seen here : http://trad.spip.org/spip.php?page=tradlang_bilan (huge page, so slow to load)

Create an account to access to the private publication area and see how it works.

The template of this website isn’t actually on the zone (I haven’t found it) so you should ask for it to kent1 (kent1@arscenic.info) who is maintaining it.

.Gilles

Friendly,


Suske


spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

Yes. I’ve heard about Salvatore. As I know, it is used for general translation of plugins.
But I am wondering about the case when we need to modify some translation items for specific web site. It would be great to do this in administration part of site.

The plugin (http://www.spip-contrib.net/Plugin-Items-Traductions) should work with your local file
squelettes/langlocal_ru.php
It’s marked as compatible for SPIP2.0 : have you done some modification to make it compatible with SPIP2.1 ?
If so, it would be nice to share on the zone :wink:

On Fri, Apr 20, 2012 at 11:56 AM, Алексей Ярощук <a.yaroshuk@aloha.org.ua> wrote:

Yes. I’ve heard about Salvatore. As I know, it is used for general translation of plugins.
But I am wondering about the case when we need to modify some translation items for specific web site. It would be great to do this in administration part of site.


spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

It looks like local_xx.php really helps to solve my problem.
For example, if I define item in local_xx.php file:

‹ status › => ‹ Local status ›

wich is also defined in ecatalogue_xx.php:

‹ status › => ‹ Ecatalogue status ›

and use it like this:

<:ecatalogue:status:>

I get what I want - Local status.
So to redefine only that items that we need we must redefine them in squelettes/lang/local_xx.ru file.

But I see one more problem that this solution brings. What it if I have another plugin that also has ‹ status › lang item in it, and I don’t want to redefine this item?
For example, we also have plugin Alohacart with lang file alohacart_xx.php and ‹ status › item in it:

‹ status › => ‹ Alohacart status ›.

So now, when I redefined ‹ status › item in local file, and use <:alohacart:status:>, I get ‹ Local status ›. But I want it to be ‹ Alohacart status ›.Of course, the simplest solution will be to name items in different manner, like ‹ ecatalogue_status › and ‹ alohacart_status ›, so later we can redefine them easily.
But I thought that prefix in <:prefix:lang_item:> construction must be enough to define where to find item, because I think it is awkward to write something like

<:ecatalogue:ecatalogue_status:>

It’s marked as compatible for SPIP2.0 : have you done some modification to make it compatible with SPIP2.1 ?
If so, it would be nice to share on the zone :wink:

Yes. We fixed it, so now we can use it with SPIP 2.1.xx and also added some additional functionality like synchronizing content of DB and local files.
We will commit it in near future.

On 20/04/2012 11:56, Алексей Ярощук wrote:

Yes. I've heard about Salvatore. As I know, it is used for general
translation of plugins.
But I am wondering about the case when we need to modify some
translation items for specific web site. It would be great to do this in
administration part of site.

For these cases, I use the skeleditor plugin (which permits to edit the files in /squelettes) and the squelettes/local_xx.php files.

Of course four "usual users", an interface should be better than editing a php file but "advanced" users can do it after a small and quick formation.

--
Suske

On 20/04/2012 11:32, Gilles Vincent wrote:

You should use squelettes/lang/local_ru.php and insert your lan items
with <:lang_item:>
It's definition is first searched into this user lang file. And if it's
not found SPIP looks at the language files of the plugins.

No need to suppress the prefix in <:prefix:lang_item:> if you override it with squelettes/local_xx.php !

local_xx.php has the first priority like any other files in squelettes, what ever the prefix could be.

The point is:
- when you update the plugin with new <:prefix_items:> and their translations, the items will be used by SPIP then eventually overriden by local_xx.php
- if you copy the full path and flies in squelettes, the files are used by spip (main priority) and therefore, your new items won't be seen by SPIP.

--
Suske

On 20/04/2012 12:40, Алексей Ярощук wrote:

But I see one more problem that this solution brings. What it if I have
another plugin that also has 'status' lang item in it, and I don't want
to redefine this item?
For example, we also have plugin Alohacart with lang file
alohacart_xx.php and 'status' item in it:

    'status' => 'Alohacart status'.

Yes. There is the langonet plugin which can help to identify the <:chains:> and translations provided by different plugins.

When you find such a problem, i'm afraid the only solution is to report and adapt one or the other plugin...

So now, when I redefined 'status' item in local file, and use
<:alohacart:status:>, I get 'Local status'. But I want it to be
'Alohacart status'.
Of course, the simplest solution will be to name items in different
manner, like 'ecatalogue_status' and 'alohacart_status', so later we can
redefine them easily.
But I thought that prefix in <:prefix:lang_item:> construction must be
enough to define where to find item, because I think it is awkward to
write something like

    <:ecatalogue:ecatalogue_status:>

Perhaps can you define <:alohacart:status:> in local_ru.php, I never tried this.

Yes. We fixed it, so now we can use it with SPIP 2.1.xx and also added
some additional functionality like synchronizing content of DB and local
files.
We will commit it in near future.

Super !

--
Suske

<:local:status:> vs <:alohacart:status:> doesn’t work ?

On Fri, Apr 20, 2012 at 12:40 PM, Алексей Ярощук <a.yaroshuk@aloha.org.ua> wrote:

It looks like local_xx.php really helps to solve my problem.
For example, if I define item in local_xx.php file:

‹ status › => ‹ Local status ›

wich is also defined in ecatalogue_xx.php:

‹ status › => ‹ Ecatalogue status ›

and use it like this:

<:ecatalogue:status:>

I get what I want - Local status.
So to redefine only that items that we need we must redefine them in squelettes/lang/local_xx.ru file.

But I see one more problem that this solution brings. What it if I have another plugin that also has ‹ status › lang item in it, and I don’t want to redefine this item?
For example, we also have plugin Alohacart with lang file alohacart_xx.php and ‹ status › item in it:

‹ status › => ‹ Alohacart status ›.

So now, when I redefined ‹ status › item in local file, and use <:alohacart:status:>, I get ‹ Local status ›. But I want it to be ‹ Alohacart status ›.Of course, the simplest solution will be to name items in different manner, like ‹ ecatalogue_status › and ‹ alohacart_status ›, so later we can redefine them easily.
But I thought that prefix in <:prefix:lang_item:> construction must be enough to define where to find item, because I think it is awkward to write something like

<:ecatalogue:ecatalogue_status:>

It’s marked as compatible for SPIP2.0 : have you done some modification to make it compatible with SPIP2.1 ?
If so, it would be nice to share on the zone :wink:

Yes. We fixed it, so now we can use it with SPIP 2.1.xx and also added some additional functionality like synchronizing content of DB and local files.
We will commit it in near future.


spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

Hi Gilles!

How to make the plugin to be indexed by Salvatore?
I mean « Composition » or « Metas » or any other existing plugins that not indexed now/

Thanks in advance
Serge

20 апреля 2012 г. 12:49 пользователь Gilles Vincent <gilles.vincent@gmail.com> написал:

On Fri, Apr 20, 2012 at 11:25 AM, Suske <suske@brubel.net> wrote:

And also I have another interesting question. *Is there any plugin that
allows us to edit lang items of plugins from admin page? *

I know about plugin « Items & Traductions ». But as I know it is a little
out of date and doesn’t allow to work with plugin’s lang files. And also
it has some problems and errors.
For needs of our company we fixed this plugin to work properly with SPIP
2.x. I wonder if anyone is using this plugin and whether should we
commit this our version to repository or not?

The « SPIP-zone » is open to contributors !

Inscription:

  • go to http://listes.rezo.net/mailman/listinfo/spip-zone and write in
  • send then an e-mail to the list describing your project and asking for codes to write to the svn repository
  • There is a non translated « charte »: the global meaning is « the zone is for GPL projects and collaborative developpments ». Of course, debugging an old unmaintained plugin is a good project.

You should look at the tool Salvatore that is used to translate the lang files.
If your plugin is local, you have to adapt it a little and it will work like a charm !

If your plugin is on the zone, it may be changed a little to be referenced by the official Salvatore - and then you will be able to translate the plugin with the translation community.

To translate plugins indexed by Salvatore, it’s here : http://trad.spip.org/
The french documentation of Salvator is here : http://trad.spip.org/f-a-q/article/que-fait-salvatore
The global translation status can be seen here : http://trad.spip.org/spip.php?page=tradlang_bilan (huge page, so slow to load)

Create an account to access to the private publication area and see how it works.

The template of this website isn’t actually on the zone (I haven’t found it) so you should ask for it to kent1 (kent1@arscenic.info) who is maintaining it.

.Gilles

Friendly,


Suske


spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en


spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

On 20/04/12 09:52, Алексей Ярощук wrote:

And also I have another interesting question. *Is there any plugin that allows
us to edit lang items of plugins from admin page? *

Hi. We use a old but adapted version of « trad_lang », which keeps the translations in a database table and also writes them out to the property files.

It has been adapted in that it:
- works with modern versions of PHP
- writes all languages in UTF8, instead of HTML entities.
Unfortunately, somewhere along the way, I lost the ability to translate multiple modules. It would be quite good to find that again...

RastaPopolous is working on a new version, which functions with SPIP 3. It is already used here: http://trad.spip.org/

Paolo