[horde] Links to Ingo (Forward, Vacation) in top menu bar

Vilius Sumskas/LNK vilius at lnk.lt
Tue May 26 08:38:45 UTC 2015


> >>>>>>>>> Hello List,
> >>>>>>>>>
> >>>>>>>>> I need your help.
> >>>>>>>>>
> >>>>>>>>> I inserted the following part into "$this->applications = 
array"
> >>> in
> >>>>>> the
> >>>>>>>>> registry.local.php file.
> >>>>>>>>>
> >>>>>>>>> ------------
> >>>>>>>>>         'forwards' => array(
> >>>>>>>>>             'url' => '/ingo/basic.php?page=forward',
> >>>>>>>>>             'name' => _("Forward"),
> >>>>>>>>>             'status' => 'active',
> >>>>>>>>>             'menu_parent' => 'imp',
> >>>>>>>>>             'fileroot' => '/tmp'
> >>>>>>>>>         ),
> >>>>>>>>>
> >>>>>>>>>         'vacations' => array(
> >>>>>>>>>             'url' => '/ingo/basic.php?page=vacation',
> >>>>>>>>>             'name' => _("Vacation"),
> >>>>>>>>>             'status' => 'active',
> >>>>>>>>>             'menu_parent' => 'imp',
> >>>>>>>>>             'fileroot' => '/tmp'
> >>>>>>>>>         ),
> >>>>>>>>> ------------
> >>>>>>>>>
> >>>>>>>>> I don't know if this is the correct way, to get the links to
> > ingo
> >>>>>>>>> forward and vacation into the top bar.
> >>>>>>>>>
> >>>>>>>>> At least partially it is working, what I have done. The links
> > are
> >>>>>>>>> visible, and they point to the right target.
> >>>>>>>>> Sadly the translation of the "name" isn't constantly working. 
It
> >>> is
> >>>>>> only
> >>>>>>>>
> >>>>>>>>> translated, if I'm located on an ingo page. If I'm unter
> > kronolith
> >>>>>> and
> >>>>>>>>> want to go to Ingo/Forward, the link name of Forward isn't
> >>>>>> translated.
> >>>>>>>>>
> >>>>>>>>> How can I solve that?
> >>>>>>>>
> >>>>>>>> I'm not 100% sure how gettext works, but that's probably 
because
> >>> these
> >>>>>>>> translated strings only exist in Ingo PO/MO module.
> >>>>>>> That sound's plausible.
> >>>>>>>>
> >>>>>>>> If you change the location of translation strings, e.g. move 
them
> >>> from
> >>>>>>>> Ingo to Base module, you need to update translation files
> >>> accordingly.
> >>>>>>>>
> >>>>>>> For updating the translation files there is the
> > "horde-translation"
> >>>>>>> script, I guess.
> >>>>>>> So I shortly went though the documentation and found
> >>>>>>> "horde-translation update -l ll".
> >>>>>>> The script was executed with no error an for some modules it 
says
> >>>>>> "updated".
> >>>>>>> Then I executed "horde-translation make -l ll", but the shown
> >>> results
> >>>>>>> are empty.
> >>>>>>
> >>>>>> Did you specify your locale in place of "ll" flag or did you run
> > the
> >>>>>> commands exactly as you wrote?
> >>>>> Yes, I ran the commands exactly as I wrote.
> >>>>>
> >>>>> Meanwhile I'm one step further, I have tried the commands for only
> >>>>> one module and language.
> >>>>>
> >>>>> horde-translation update -m horde -l de
> >>>>> horde-translation make -m horde -l de
> >>>>>
> >>>>> But no changes were found and translation isn't working.
> >>>>> After checking the horde.po file, I realized that only the
> >>>>> config/registry.php is mentioned.
> >>>>>
> >>>>> My changes in config/registry.local.php are ignored by the
> >>>>> translation script.
> >>>>> After inserting my changes into config/registry.php and repeating
> >>>>> the commands.
> >>>>> The changes were recognized and automatically translated for that
> >>>>> module and language.
> >>>>>
> >>>>> So my next question are.
> >>>>> Is there option for the horde-translation script to make it search
> >>>>> the "config/registry.local.php" file?
> >>>>
> >>>> No.
> >> I thought so.
> >>>>
> >>>>> What happens to the translation after an update?
> >>>>
> >>>> What do you mean?
> >>>
> >>> I think he means what happens to the translation after Horde update 
-
> >>> translations are updated obviously, so your changes will be lost.
> >> Yes, correct.
> >>>
> >>> I don't know gettext enough but it should be possible to have a
> > separate
> >>> .mo file in the same category as horde.mo is and then load it in 
your
> >>> .local.php files.
> >>>
> >>> For example:
> >>>
> >>> LC_MESSAGES/
> >>>       horde.mo
> >>>       local.mo
> >>>
> >>> Then in local.php file use something like this:
> >>>
> >>> 'name' => dgettext('local', "Your String");
> >>>
> >>> Of course you have to use your own gettext tools to create such
> > .po/.mo
> >>> file. There are dozen of them on the web.
> >>>
> >>> That's probably an overkill for two strings though.
> >>>
> >> This approach sounds good, but as you say, right now it's to time
> >> expensive.
> >> It would have been nice if the horde translation script would
> >> automatically search the *.local.php files and create such split for 
the
> >
> >> language files. But that's probably a feature not often used.
> >
> > horde-translation was created to help create official Horde 
translations.
> > As .local.php files contain local modifications the script was
> > specifically designed to ignore them.
> >
> >> I will use a short script after an update, which inserts my changes 
to
> >> the registry.php and runs the horde-translation commands.
> >>
> >> I used the following commands to create the German translation.
> >>
> >> horde-translation update -l de
> >> horde-translation make -l de
> >>
> >> The results are fine without further actions.
> >>
> >> Now I thought I could do the same for other languages. For example fr
> >> (horde-translation update -l fr)
> >> The result is I, now have the German translations in the French 
language
> >
> >> files.
> >> What's my mistake?
> >
> > You probably need to delete compendium.po every time you run a 
translation
> > update.
> >
> > Anyway, if I were you I wuold just use something like POEdit once and
> > forget about it. Or use msggrep/msgmerge directly from the command 
line to
> > create local.po/local.mo file.
> >
> I used POEdit to create local.po/local.mo file, but they won't get 
> recognized.
> 
> In my registry.local.php I changed the name part to
> "'name' => dgettext('local', "Forwards")" as mentioned above.
> 
> How does php know where to search for the local.po/local.mo file?
> 
> I read something about
> bindtextdomain("local", "//path/to/my/locale/folder")
> 
> But I don't know how to use it right in this context.
> 
> Can someone advise me if I have to use "bindtextdomain" and where to put 
it?
> 
> The mentioned "//path/to/my/locale/folder" is the relative path to 
> Document Root of the server?

Ah, yes, you should also remember to bindtextdomain. It can be done in the 
same registry.local.php file. The path can be both absolute or relative to 
file where you bind it (e.g. to registry.local.php).

-- 
   Vilius



More information about the horde mailing list