You are not logged in.

#1 2020-02-08 21:47:38

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

prepend.csv i18n

I've added internationalization support (i18n) for the prepend.csv and append.csv files in the the jgmenu-apps(1) module.

Try it out by taking the following steps:

Add the file Swedish translation file
to /usr/share/bunsen/i18n/ (or wherever)

Add the following to your jgmenurc:

csv_i18n = /usr/share/bunsen/i18n

Run jgmenu from the terminal with

LANG=sv_SE.utf8 jgmenu

It doesn't matter if you haven't enabled sv_SE.utf8 (locale -a).

I'm posting it here to see if you think it's got legs. Otherwise I'll drop it.

There is a bit more work to do:
- Complete the Swedish translation file cover all pipe-menus
- Add code to support widget translation (e.g. the "Type to Search")

Note:
- There is no rush in creating translation files. If there is no translation file to match a user's $LANG, jgmenu just uses prepend.csv as it is.
- Translation files can be partial. I.e. if there is no hashmap entry for a particular menu entry, jgmenu just uses the English name.

Offline

#2 2020-02-09 05:48:06

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: prepend.csv i18n

Looks very encouraging. Though I don't have time to do any extensive testing right now, if it turns out viable this - ie other languages -  might be a great way of getting some contributions from forum members...


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#3 2020-02-09 07:11:51

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: prepend.csv i18n

malm wrote:

Add the file Swedish translation file
to /usr/share/bunsen/i18n/ (or wherever)

Add the following to your jgmenurc:

csv_i18n = /usr/share/bunsen/i18n

What should the Swedish file be named?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#4 2020-02-09 07:18:46

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

Re: prepend.csv i18n

sv

Offline

#5 2020-02-09 07:52:16

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: prepend.csv i18n

...mixed results.
Swedish entries appear only in a few places, like the "Applications" submenu. Not in the top-level menu, and not in "Preferences".

Warning about locale:

john@lithium-test:~$ LANG=sv_SE.utf8 jgmenu
warning: setlocale(): locale not supported by C library; using 'C' locale
info: using built-in schema data
info: i18n: translation file '/usr/share/bunsen/i18n/sv' loaded
info: i18n: translation file '/usr/share/bunsen/i18n/sv' loaded
...

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#6 2020-02-09 15:44:33

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

Re: prepend.csv i18n

Have you built the master branch - sorry, should have said...

Offline

#7 2020-02-09 15:46:29

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

Re: prepend.csv i18n

The .desktop applications are always translated anyway, this is for prepend.csv and pipemenus...

Offline

#8 2020-02-10 00:30:48

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: prepend.csv i18n

Ah, I was testing on 4.0.2

I see with the .desktop files, even without i18n/sv the Swedish locale elicits translated entries in "Applications".

BTW 4.0.2 on Stretch (Buster is OK) running 'LANG=sv_SE.utf8 jgmenu' throws an error:

john@helium:~$ LANG=sv_SE.utf8 jgmenu
warning: setlocale(): locale not supported by C library; using 'C' locale
warning: 'at_pointer' is deprecated; use 'position_mode'
warning: 'at_pointer' is deprecated; use 'position_mode'
Warning: setting locale failed! Use an available locale as listed by 'locale -a'.
Traceback (most recent call last):
  File "/usr/lib/jgmenu/jgmenu-pmenu.py", line 508, in <module>
    main()
  File "/usr/lib/jgmenu/jgmenu-pmenu.py", line 505, in main
    create_menu(append_file, prepend_file)
  File "/usr/lib/jgmenu/jgmenu-pmenu.py", line 420, in create_menu
    cat_file(arg_prepend_file)
  File "/usr/lib/jgmenu/jgmenu-pmenu.py", line 410, in cat_file
    print(data_file.read())
UnicodeEncodeError: 'ascii' codec can't encode characters in position 87-88: ordinal not in range(128)
fatal: file did not contain any menu items

My locale 'LANG=en_GB.utf8 jgmenu' is fine though.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#9 2020-02-10 07:24:36

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

Re: prepend.csv i18n

Don’t worry about the locale issues. They are caused by not having enabled sv_SE.utf8.
The LANG override is just a hack, to demo the menu - not to be used in real life.

Set csv_cmd=apps

It is not supported on lx and pmenu. Assumed you were already running apps.

Offline

#10 2020-02-12 03:10:02

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: prepend.csv i18n

^Using 'apps' on my Lithium VM, but main Stretch machine's jgmenu was still set to 'pmenu' because 'lx' wasn't supported on Stretch. Just now tried switching to 'apps' and it works fine. The locale error disappears when using apps, though (with jgmenu 4.0.2+bl9-1) the translation is limited to "Browse here" and "Recent files" headers only.

OT//
I notice that there is a lot of duplication of items with the apps menu, resulting in much longer submenus than with pmenu. Any plans to fix that?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#11 2020-02-12 16:31:30

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

Re: prepend.csv i18n

John, I only added the prepend.csv i18n feature after 4.0.2, so need to build master branch.

Re duplication of items in submenus, I got a lot of feedback from pmenu users saying that they didn’t like the “once only” policy. XDG menu-spec also defaults to showing duplications.

It should be easy to optionally enable “once only”. Is that a feature request - before I spend time on it?

Offline

#12 2020-02-13 08:12:41

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: prepend.csv i18n

malm wrote:

Re duplication of items in submenus, I got a lot of feedback from pmenu users saying that they didn’t like the “once only” policy. XDG menu-spec also defaults to showing duplications.

In that case, never mind - it's just my preference against theirs.

It should be easy to optionally enable “once only”. Is that a feature request - before I spend time on it?

But OTOH, if it would be easy to make "once only" optional, not fixed then maybe some users would appreciate it?

Also, is it possible to edit arrangement of items in menu sections ala XDG menus?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#13 2020-02-13 21:18:02

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

Re: prepend.csv i18n

johnraff wrote:

But OTOH, if it would be easy to make "once only" optional, not fixed then maybe some users would appreciate it?

I've added a new config option for it: 5d76128c
It removes a dozen(ish) duplicates on Lithium.

Also, is it possible to edit arrangement of items in menu sections ala XDG menus?

Yes, see jgmenu-apps(1) for details and an example "schema" file (which maps categories to directories).

For full XDG compliance, use the lx module. But be warned... XDG menu-spec made my head hurt which is why I wrote the apps module.

Offline

#14 2020-02-14 02:31:07

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: prepend.csv i18n

malm wrote:

I've added a new config option for it: 5d76128c
It removes a dozen(ish) duplicates on Lithium.

Wow! You work fast. Many thanks.

Also, is it possible to edit arrangement of items in menu sections ala XDG menus?

Yes, see jgmenu-apps(1) for details and an example "schema" file (which maps categories to directories).

Thanks again, that's perfect. Your documentation just gets better and better. We should have a link to 'man jgmenu-apps' in Preferences>jgmenu I guess.

BTW from what jgmenu version is the apps module available? We should have a version on the dependency (Recommends: in fact) in bunsen-configs.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#15 2020-02-14 05:58:29

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,036
Website

Re: prepend.csv i18n

johnraff wrote:
malm wrote:

Re duplication of items in submenus, I got a lot of feedback from pmenu users saying that they didn’t like the “once only” policy. XDG menu-spec also defaults to showing duplications.

In that case, never mind - it's just my preference against theirs.

I prefer one entry per app, but Johan is right, it's been duplicate entries since I started using Linux. It's a major pain to edit the *.desktop files to appear in only one category, but I'm sure most users couldn't be bothered or wouldn't even notice the dupes.

Also, jgmenu "Type to search" will bring up the item no matter where it's located or duplicated in the menu structure. I second, or third at this point, leave it be.

Last edited by hhh (2020-02-14 06:00:58)


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Online

#16 2020-02-25 06:35:55

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: prepend.csv i18n

malm wrote:

I'm posting it here to see if you think it's got legs.

Works perfectly. cool

Sorry it took so long to find that out.

I'm curious about the mechanism though - are the translated strings substituted on every call to the menu, or cached when the daemon starts up?

When I start it in a terminal click somewhere to close it, then do a right-click on the desktop for a new menu it reverts to English with a message "fatal: cannot grab keyboard" in the original terminal. How should the daemon be started so that the Swedish version is set permanently?

Most applications with translated interfaces use a set of *.mo files under /usr/share/locale/ - why have you chosen not to follow that? Or would that happen if the system proved stable? Although, your syntax looks the same as the samples here: http://mywiki.wooledge.org/BashFAQ/098# … g_PO_files

(I'm tempted to try writing a Japanese version.)

Last edited by johnraff (2020-02-25 06:39:17)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

Board footer

Powered by FluxBB