Skip to content
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

Add templates to Config Files menu #3396

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ntrel
Copy link
Member

@ntrel ntrel commented Feb 13, 2023

Also fix the first line of geany.css being uncommented when opening the config file through the menus.

@ntrel
Copy link
Member Author

ntrel commented Apr 9, 2023

I've split out #3450 which should be merged first.
After that, I'd like to merge this.

@elextr
Copy link
Member

elextr commented Apr 10, 2023

I guess it saves users explicitly copying template files to the user config directory before editing and maybe reduces the incidence of them editing the system copies. But most templates distributed with Geany are pretty ummm basic, so I'm not sure how often they are used as a basis for user templates.

Note the #3450 changes still included, needs to be removed, especially if #3450 is not needed.

src/templates.c Show resolved Hide resolved
src/templates.c Show resolved Hide resolved
src/ui_utils.c Outdated Show resolved Hide resolved
@techee
Copy link
Member

techee commented Oct 6, 2023

Overall the PR looks good to me.

@ntrel
Copy link
Member Author

ntrel commented Oct 6, 2023

@techee Thanks for reviewing. I've approved #3576.

@kugel-
Copy link
Member

kugel- commented Oct 7, 2023

This touches strings (doesn't it?) and we're in string freeze so I'm afraid it's too late now.

@ntrel
Copy link
Member Author

ntrel commented Oct 8, 2023

@kugel- what bad thing would happen if this was merged? the strings here would still lookup the correct translations, right?

@elextr
Copy link
Member

elextr commented Oct 8, 2023

Don't strings have file/line in their lookup, so "Templates" and "Files" menu items would likely show untranslated until updated?

Also I don't see those referenced in the documentation modifications?

@eht16
Copy link
Member

eht16 commented Oct 8, 2023

Don't strings have file/line in their lookup, so "Templates" and "Files" menu items would likely show untranslated until updated?

How do you think so? AFAIK the lookup is made solely on the string itself. Either it matches or not.

Before further speculating, just test it. Check out the branch, run make -C po update-po and check whether it broke any ".po" file.

Also I don't see those referenced in the documentation modifications?

I don't understand what does this mean? :).

@elextr
Copy link
Member

elextr commented Oct 8, 2023

How do you think so? AFAIK the lookup is made solely on the string itself. Either it matches or not.

Oh, I thought it was possible to have the same string at different places in the program with differing translations? If not by file/line how is that done? (translation newby question)

Did I say it would break anything? Just that the strings would be untranslated, and even if all cases of the same string have the same translations, do "Templates" or "Files" occur in the UI anywhere already?

I'm not sure what the point of running update PO is, we don't do that for each PR. That was done at string freeze and will not have these strings in it, so they will not be translated thats all.

I don't understand what does this mean? :).

There are changes to geany.txt included in this PR, so I expected they were the documentation associated with this change. But weirdly the documentation changes do not use either of the words Templates or Files so I'm not sure how they document the new menu entries ;-)

@@ -3973,8 +3973,8 @@ On Windows 7 and above you most likely will find it at:
``C:\users\UserName\Roaming\geany``


Tools menu items
----------------
Configuration files menu
Copy link
Member

Choose a reason for hiding this comment

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

While this section is currently mainly about the Configuration files menu item, I think we could leave the section title as is. We might add further documentation for other Tools menu items here as well, so the more generic section title would serve as a container and so we could add a sub heading for Configuration files.

Though I don't have a strong opinion on that.

@eht16
Copy link
Member

eht16 commented Oct 8, 2023

How do you think so? AFAIK the lookup is made solely on the string itself. Either it matches or not.

Oh, I thought it was possible to have the same string at different places in the program with differing translations? If not by file/line how is that done? (translation newby question)

AFAIK this is not possible. If so, then there is some special syntax or so. Usually, the lookup is done based only on the string.
Example for the string "Templates" used in here:

#: data/geany.glade:5527 src/prefs.c:1625 src/templates.c:325
msgid "Templates"
msgstr ""

As you can see the translation item has the multiple code occurrences listed as comment.

Maybe @frlan knows better.

Did I say it would break anything? Just that the strings would be untranslated, and even if all cases of the same string have the same translations[...]

I meant "break" in terms of "new untranslated strings which would break the string freeze". Sorry, it wasn't the best wording.

do "Templates" or "Files" occur in the UI anywhere already?

Yes, see the example above.

I'm not sure what the point of running update PO is, we don't do that for each PR.

I suggested this so one can test whether the added strings here will be translated or not to stop us speculating whether or not it will have an effect.
To get this further, I just did it myself: applied the patch, ran make -C po update-po, checked the re-generated translation files, there are no new untranslated strings, ran Geany with a non-English locale and saw that the new menu items got properly translated by the already existing translations for "Template" and "Files".

That was done at string freeze and will not have these strings in it, so they will not be translated thats all.

This isn't the case, see above.
I wonder why we discuss this so long with much guessing what might happen instead of just testing it to get sure :(.

I don't understand what does this mean? :).

There are changes to geany.txt included in this PR, so I expected they were the documentation associated with this change. But weirdly the documentation changes do not use either of the words Templates or Files so I'm not sure how they document the new menu entries ;-)

To me the changed parts in the documentation are related to the feature.

@eht16
Copy link
Member

eht16 commented Oct 8, 2023

Long story short about the translation strings: this is safe to merge, it will NOT add new untranslated strings.

@elextr
Copy link
Member

elextr commented Oct 8, 2023

As you can see the translation item has the multiple code occurrences listed as comment.

After some googling (while also watching renovation TV so it was a bit slow :-) I found that:

  1. a string can only occur once in the PO files, so one string and commenting the places its used is the only way
  2. if a string needs two translations, like as a noun and a verb, a manual msgctxt is needed to separate them, not file/line.

That is different to the commercial system I have used in the past. As I said I don't know much about gettext but I have learned some more. "learn a new thing every day" they say, so I can take the rest of the day off ... all 1.25 hours.

I wonder why we discuss this so long with much guessing what might happen instead of just testing it to get sure :(.

Because I am not at home sitting in front of my development machine to be able to do it.

Long story short about the translation strings: this is safe to merge, it will NOT add new untranslated strings.

Ok, so is the actual change ok? If so you and @techee are listed as reviewers and can approve it.

@eht16
Copy link
Member

eht16 commented Oct 11, 2023

Tested and works fine.

Maybe we could squash some of the commits?

@eht16
Copy link
Member

eht16 commented Oct 14, 2023

@ntrel @elextr

I tested and it works great.

Apart from the little remark on the docs, I'm fine with this.
About the section comment in the docs, this is no big deal, we can also leave as it is.

Copy link
Member

@b4n b4n left a comment

Choose a reason for hiding this comment

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

Looks fairly useful and simple enough 👍
Apart from my inline comments, LGTM and WFM.

Comment on lines +309 to +310
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_menu_reorder_child(GTK_MENU(menu), item, 0);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_menu_reorder_child(GTK_MENU(menu), item, 0);
gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item);

Comment on lines -2878 to +2881
/* put entries with submenus at the end of the menu */
/* put entries with submenus at the start of the menu */
if (gtk_menu_item_get_submenu(item_a) && !gtk_menu_item_get_submenu(item_b))
return 1;
else if (!gtk_menu_item_get_submenu(item_a) && gtk_menu_item_get_submenu(item_b))
return -1;
else if (!gtk_menu_item_get_submenu(item_a) && gtk_menu_item_get_submenu(item_b))
return 1;
Copy link
Member

Choose a reason for hiding this comment

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

This confused me because it's already in #3397, so it's actually not part of this PR anymore. But 👍 anyway.

@b4n
Copy link
Member

b4n commented Oct 17, 2023

Should we postpone? Review the comments and merge?

@b4n b4n modified the milestones: 2.0, 2.1 (or something?) Oct 18, 2023
@b4n
Copy link
Member

b4n commented Oct 18, 2023

Postponing as it's a bit late now. Should probably be merged soon after release though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants