+
Skip to content

FvwmPager: Allow translation of "Desk %d" label via Gettext #1216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 21, 2025

Conversation

ONykyf
Copy link
Contributor

@ONykyf ONykyf commented Jun 19, 2025

"Desk %d" label at the top of FvwmPager comes always in English, and can be easily localized in *.po (and then *.mo) translation file.

"Desk %d" label at the top of FvwmPager comes always in English, and
can be easily localized in *.po (and then *.mo) translation file.
Comment on lines 250 to 252
/* Initialize translations. */
FGettextInit("fvwm3", LOCALEDIR, "FvwmPager");

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't do this, we do not need to create a .pot file for FvwmPager that contains one string, instead add this to the .pot file for fvwm3. I have moved all the translations into a single file since they are overall quite small in fvwm.

FGettextInit("fvwm3", LOCALEDIR, "fvwm3");

Copy link
Contributor Author

@ONykyf ONykyf Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nobody is going to create a separate *.pot file. The name of this file is determined with the first argument domain, which is "fvwm3" everywhere. The third argument module is just used in log messages, hence all translated messages are collected to fvwm3.pot. All my translations to FvwmForm and FvwmPager are in fvwm3.po, and everything works OK, You can verify it yourself.

I have noticed that module is also set to "fvwm3" in the existing code, but there is no point for this, we lose additional debug info. I would rather add different module parameters for different Fvwm modules.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, yea, I guess the second string is never actually used in any meaningful way. When I updated all the translation stuff I did away with separate translations per modules as it was way harder to maintain, and I just changed all the calls to what I suggested. Please just update it to be consistent with how I have it setup for other modules to use this wrapper. Though the actual string you send for the module name has no actual effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then You might consider just removing the third parameter everywhere, because in this case it is meaningless anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but at the time that I combined all the pot files, I just went with what is there. Problem with such an old project is there are lots of things like this, but they are working, so it really isn't that important.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have searched the code through, and FGModuleName variable, which is set by module parameter, is used only once, so no real profit, and it can be safely ignored (or removed, which is even better), so let it be "fvwm3".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then You might consider just removing the third parameter everywhere, because in this case it is meaningless anyway.

Nah, it can stay. I don't want to change it just for code-churn.

@somiaj
Copy link
Collaborator

somiaj commented Jun 19, 2025

You should also be more complete on your pull requests, FvwmPager now outputs the 'Monitor RANDRNAME' string if configured, that should also be translated. I can't think of any other strings that might need translated off the top of my head, but you should add those too. Also this pr will need to follow the instructions to update the main fvwm3.pot file with any new strings.

@ONykyf
Copy link
Contributor Author

ONykyf commented Jun 19, 2025

You should also be more complete on your pull requests, FvwmPager now outputs the 'Monitor RANDRNAME' string if configured, that should also be translated.

Could You point me to the place in the code where this string is output? I looked through the FvwmPager code and have found no more strings to translate. As far as I remember, "Monitor " is not output before the name, I checked it specifically (but I might be wrong).

I can't think of any other strings that might need translated off the top of my head, but you should add those too. Also this pr will need to follow the instructions to update the main fvwm3.pot file with any new strings.

It is updated because ../modules/FvwmPager/FvwmPager.c is added to POTFILES and fvwmpo.sh. It also works well in my setup and build script.

@somiaj
Copy link
Collaborator

somiaj commented Jun 19, 2025

Could You point me to the place in the code where this string is output? I looked through the FvwmPager code and have found no more strings to translate. As far as I remember, "Monitor " is not output before the name, I checked it specifically (but I might be wrong).

The function which is drawing the labels is draw_desk_label in x_pager.c. I guess I was incorrect, the names are just RandR names, so there is nothing to be translated. But You may want to consider that there are also a small alternative to the labels that appear with small pagers, for desks, the label will just be Dn instead of Desk n (or whatever is set). You may want to translate that too?

@somiaj
Copy link
Collaborator

somiaj commented Jun 19, 2025

It is updated because ../modules/FvwmPager/FvwmPager.c is added to POTFILES and fvwmpo.sh. It also works well in my setup and build script.

I saw, I was just saying run ./fvwmpo.shas part of this PR, so any new translation strings you have added are included in the .pot, vs waiting for some translator (which are very rare in fvwm) to come along and do that.

@ONykyf
Copy link
Contributor Author

ONykyf commented Jun 19, 2025

But You may want to consider that there are also a small alternative to the labels that appear with small pagers, for desks, the label will just be Dn instead of Desk n (or whatever is set). You may want to translate that too?

It's a nice idea, I will look at this now.

@ONykyf
Copy link
Contributor Author

ONykyf commented Jun 19, 2025

It is updated because ../modules/FvwmPager/FvwmPager.c is added to POTFILES and fvwmpo.sh. It also works well in my setup and build script.

I saw, I was just saying run ./fvwmpo.shas part of this PR, so any new translation strings you have added are included in the .pot, vs waiting for some translator (which are very rare in fvwm) to come along and do that.

Ok, I will do it now.

Comment on lines -63 to +65
initialize_desks_and_monitors();
initialize_fonts();
initialize_desks_and_monitors();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

@ONykyf ONykyf Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because initialize_fonts() contains localization and (since now) translation, and initialize_desks_and_monitors() uses it to set desk label. I have checked that there is no other interference between these two functions.

@@ -31,6 +31,7 @@
#include <stdbool.h>

#include "libs/FShape.h"
#include "libs/FGettext.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not strictly "missing" per-se, in that it comes via libfvwm3.a, but it's fine to explicitly include it here.

@ThomasAdam ThomasAdam added area:doc Relates to documentation only relates:module Issue is in module code labels Jun 21, 2025
@ThomasAdam ThomasAdam added this to FVWM3 Jun 21, 2025
@github-project-automation github-project-automation bot moved this to PRs in FVWM3 Jun 21, 2025
@ThomasAdam ThomasAdam added this to the 1.1.4 milestone Jun 21, 2025
@ThomasAdam
Copy link
Member

OK.

@ThomasAdam ThomasAdam merged commit 6000175 into fvwmorg:main Jun 21, 2025
8 checks passed
@github-project-automation github-project-automation bot moved this from PRs to Done in FVWM3 Jun 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:doc Relates to documentation only relates:module Issue is in module code
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载