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

Update gnc-commodity.cpp for finance-quote 1.63 #2033

Merged
merged 10 commits into from
Oct 31, 2024

Conversation

pkryger
Copy link
Contributor

@pkryger pkryger commented Oct 17, 2024

A few weeks ago @bpschuck asked for help with updating Gnucash for recent version of finance-quote. I hope this work a reasonable starting point.

I run the following code in [finance-quote-wrapper](https://github.com/Gnucash/gnucash/blob/05aadd0/libgnucash/quotes/finance-quote-wrapper.in#L114) to get multiple quote sources (i.e. more than one module):

use Finance::Quote;
my %qf = $q->get_features();
my $qm = $qf{quote_methods};
while (my ($k, $v) = each %$qm) {
    if (@$v > 1) {
        print "$k => @$v\n";
    }
}

Which yielded the following methods:

nasdaq => AlphaVantage FinanceAPI Fool GoogleWeb IEXCloud MarketWatch StockData YahooJSON
india => BSEIndia NSEIndia
europe => ASEGR Bourso BVB Consorsbank Sinvestor Stooq Tradegate XETRA
ukfunds => FTfunds MorningstarUK
canada => AlphaVantage TMX
usa => AlphaVantage FinanceAPI Fool IEXCloud YahooJSON
nyse => AlphaVantage FinanceAPI Fool GoogleWeb IEXCloud MarketWatch StockData YahooJSON

Then got single quote sources list using the script above, but used @$v == 1. Cross checked with finance-quote/Modules-README.yml, and tried to apply the following rules, while updating the list of modules in gnc-commodity.cpp:

  • if method names a country and has a working module - move it to multi source modules,
  • if module has been marked as failing - removed from the list,
  • if module has been marked as working and has been present in the list - left it as is (no further check),
  • if module has been marked as working, was not present in the list, and doesn't need an API key - added it to the list if and only if I could fetch a quote,
  • if module has been marked as working and requires an API key, then added it to the list.

While I think this work is probably a reasonable first cut, I think the following comments and questions should be at least reviewed by someone with more experience in this subject:

  • Used FinanceAPI instead of yahoo_json in multiple quote sources descriptions.
  • India Mutual - intiamutual looks like a multiple quote source, but has only one source, leave as is?
  • Highlighting other single source countries already in list: australia, dutch indiamutual, france, and romania.
  • Added more single source countries to multiple quote sources: india, hungary, greece, and poland.
  • Should aufund be added to multiple quote sources?
  • troweprice has been in multiple quote sources, but it has only one module. Not sure why. Removed from multiple quote sources. Also removed troweprice_direct in favour of troweprice in the single quote sources. Added as alternative in manual.
  • Added both tratedate and xetra as they seem to use more specific URL than sinvestor does.
  • Should tsx be renamed to tmx for Toronto Stock eXchange? The list originally had tsx (left it as is). Alternatively change the name to Toronto Stock eXchange (TMX), CA to highlight what TMX is.
  • bats - omitted in favour of googleweb. Or shall I add it, as say BATS Global Markets, US with a link in manual pointing to https://cboe.com (per Wikipedia)
  • tradeville - omitted in favour of bvb.
  • mstaruk - omitted, in favour of morningstaruk that has already been in the list. Added as alternative in manual.
  • Omitted all sources from hu module, that is failing ATM, that is: bamosz, bet, hufund, hustock, and hu. Moved section to deprecated in manual.
  • morningstarau - omitted, module is failing ATM.
  • oslobors - omitted, module is failing ATM.
  • cse - added, module is actually working (marked as failing in Modules-README.yml, will send a separate PR to address this).
  • comdirect - strictly speaking it is failing in 1.63, but fixed recently - included.

There's a complimentary Gnucash/gnucash-docs#345 to update relevant tables in gnucash-docs manual.

Since the change itself doesn't affect any logic (merely updates list contents) I believe a verification I performed with ninja check in debian:stable container should be sufficient.

@jralls
Copy link
Member

jralls commented Oct 18, 2024

Thanks. This at least brings the pick lists more or less up to date.

Removing sources from the list is less helpful than one might think unless F::Q has stopped providing them altogether because everything F::Q returns in a sources query gets listed: If it isn't in the single or multi lists it shows up in the unknown list.

To your details, most are fine. One exception:

Used FinanceAPI instead of yahoo_json in multiple quote sources descriptions.

How about fool instead? It doesn't need an API like financeapi.

You had some questions:

  • India Mutual - intiamutual looks like a multiple quote source, but has only one source, leave as is?

It's in both as are dutch and romania. As you note in the next two bullets it's not the only multiple that's really an alias for a single source. Remove all three of them from single_quote_sources.

  • Highlighting other single source countries already in list: australia, dutch indiamutual, france, and romania.
  • Added more single source countries to multiple quote sources: india, hungary, greece, and poland.

Which makes multisource a bit misleading. It's also redundant to have more that one source pointing at a single function; on the other hand it could be a useful abstraction should any of the primary source names be changed: Users wouldn't have to change their selections. But we should remove the ellipses where the list of sources is complete.

  • Should aufund be added to multiple quote sources?

I suppose, to be symmetrical with indiamutual.

  • Should tsx be renamed to tmx for Toronto Stock eXchange?

That just changes the UI unnecessarily. Leave it as-is.

@pkryger pkryger force-pushed the update-for-fq-1.63 branch from 2a4420c to 2349832 Compare October 18, 2024 14:27
@pkryger pkryger force-pushed the update-for-fq-1.63 branch from 2349832 to 84e6a21 Compare October 18, 2024 14:56
@pkryger
Copy link
Contributor Author

pkryger commented Oct 18, 2024

Thanks. This at least brings the pick lists more or less up to date.

Glad I can help ☺️.

[...]

Used FinanceAPI instead of yahoo_json in multiple quote sources descriptions.

How about fool instead? It doesn't need an API like financeapi.

I decided to use full names of modules in order they are queried, limiting to two modules if there are 2 or more (but expanded the list in documentation).

It's also redundant to have more that one source pointing at a single function;

This is a comment for multiple quote sources, but I guess it applies to single quote sources as well. I put the following sources in previous comment, but let me reiterate:

  • tmx is exactly the same as tsx,
  • bats is exactly the same as googleweb,
  • tradeville is exactly the same as bvb,
  • mstaruk is exactly the same as morningstaruk,
  • troweprice_direct is exactly the same as troweprice.
    I omitted the above in single_quote_sources list, even though Finance::Quote reports them in ->sources() call (they will show up as unknown). However:
  • xetra and tradegate use the same api as sinvestor, although with more specific queries (I left them in the list).

Removing sources from the list is less helpful than one might think unless F::Q has stopped providing them altogether because everything F::Q returns in a sources query gets listed: If it isn't in the single or multi lists it shows up in the unknown list.

Thank you for that clarification. This is what I got when using Gnucash. I also gather that sources that have been selected by user are stored as text (module name only) in a .gnucash file. When Gnucash opens such a file, source is still handled (i.e., price editor will show it as selected and one can fetch quotes for it as long as Finance::Quote recognises the source name). Is that correct? N.B., I personally relay on the latter as I have a hacked Finance::Quote installation with private modules on one computer that only fetches quotes, and doing most of accounting on another one where private modules are not available).

That means there are 2 sources of potentially unknown modules: the Finance::Quote and a .gnucash file. I also presume that Finance::Quote will keep adding and removing sources as state of the World changes: new quote sources appear, other disappear, some are renamed, other are merged, etc. To limit confusion as much as possible it would be nice if each source had a unique id that is communicated to Gnucash, but this is very difficult for humans to handle (at least with current interface). In any case Finance::Quote should not reuse names of sources. I.e. cse stands for Colombo Stock Exchange today. Should it disappear, and subsequently, say, a Cyprus Stock Exchange is added it should not use cse. But it is OK for name to disappear and then appear again as long as it has the same semantic (and preferably security codes). I.e. when there was no source for given country for a while. Are these assumptions correct?

@jralls
Copy link
Member

jralls commented Oct 18, 2024

Used FinanceAPI instead of yahoo_json in multiple quote sources descriptions.

How about fool instead? It doesn't need an API like financeapi.

I decided to use full names of modules in order they are queried, limiting to two modules if there are 2 or more (but expanded the list in documentation).

I think you missed the point: I'm suggesting replacing Yahoo JSON with Motley Fool instead of FinanceAPI because FinanceAPI requires an API key while Motley Fool and Yahoo don't. Considering the strict quotes/day limits on AlphaVantage maybe replace that with FinanceAPI.

I also gather that sources that have been selected by user are stored as text (module name only) in a .gnucash file. When Gnucash opens such a file, source is still handled (i.e., price editor will show it as selected and one can fetch quotes for it as long as Finance::Quote recognises the source name). Is that correct?

Yes, with a clarification: Sources are stored by the source name returned from F::Q's sources method, e.g. alphavantage. The module name, AlphaVantage.pm, isn't visible to GnuCash.

In any case Finance::Quote should not reuse names of sources. I.e. cse stands for Colombo Stock Exchange today. Should it disappear, and subsequently, say, a Cyprus Stock Exchange is added it should not use cse. But it is OK for name to disappear and then appear again as long as it has the same semantic (and preferably security codes). I.e. when there was no source for given country for a while. Are these assumptions correct?

I don't think F::Q has a way to enforce that. @bpschuck ?
Regardless, I trust that you have your private sources named in such a way that collisions with future F::Q names are unlikely.

@bpschuck
Copy link
Contributor

bpschuck commented Oct 18, 2024 via email

@jralls
Copy link
Member

jralls commented Oct 18, 2024

And the Hackers Guide/Docs could also contain a note asking contributors to look at the Modules-README.yml file and not reuse obsolete/removed module and method names.

@bpschuck does Modules-README.yaml have sources removed before you created it in 2019?

@bpschuck
Copy link
Contributor

bpschuck commented Oct 18, 2024 via email

@fellen
Copy link
Member

fellen commented Oct 19, 2024

I run the following code in [finance-quote-wrapper](https://github.com/Gnucash/gnucash/blob/05aadd0/libgnucash/quotes/finance-quote-wrapper.in#L114) to get multiple quote sources (i.e. more than one module): […]

Before it gets lost you should add the final form of your procedure as separate page Update FQ Sources[Edit] to the wiki[/Edit] and link it in Project_Administration below Dependency Updates and [Edit]at the end in the abstract (before the first section header)[/Edit] of Online_Quotes

Copy link
Member

@fellen fellen left a comment

Choose a reason for hiding this comment

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

At least for new sources we should add the region.
Think about a not US based user, who is looking for a source for their mixture of commodities. As the source names have been very cryptic at the beginning, the region is one criterion, which they should test,

{ false, SOURCE_SINGLE, "Google Web, US Stocks", "googleweb" },
{ false, SOURCE_SINGLE, "India Mutual", "indiamutual" },
{ false, SOURCE_SINGLE, "IEX (Investors Exchange), US", "iexcloud" },
{ false, SOURCE_SINGLE, "Market Watch", "marketwatch" },
Copy link
Member

Choose a reason for hiding this comment

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

Region? Seems to be US based.

Copy link
Contributor Author

@pkryger pkryger Oct 20, 2024

Choose a reason for hiding this comment

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

Yeah - but I was able to find quotes for Japanees, Chineese, Australian, German, UK, and Polish based stocks there. They seem to be positioning themselves similarly to say Bloomberg. Leaving this and other sources that are not clear to me yet as open issues for now.

Let's continue the discussion here

{ false, SOURCE_SINGLE, "Morningstar, GB", "morningstaruk" },
{ false, SOURCE_SINGLE, "Morningstar, JP", "morningstarjp" },
{ false, SOURCE_SINGLE, "Motley Fool", "fool" },
Copy link
Member

Choose a reason for hiding this comment

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

Region?

libgnucash/engine/gnc-commodity.cpp Outdated Show resolved Hide resolved
libgnucash/engine/gnc-commodity.cpp Outdated Show resolved Hide resolved
{ false, SOURCE_SINGLE, "SIX Swiss Exchange shares, CH", "six" },
{ false, SOURCE_SINGLE, "Skandinaviska Enskilda Banken, SE", "seb_funds" },
{ false, SOURCE_SINGLE, "Sharenet, ZA", "za" },
{ false, SOURCE_SINGLE, "StockData", "stockdata" },
Copy link
Member

Choose a reason for hiding this comment

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

Region?

{ false, SOURCE_SINGLE, "T. Rowe Price, US", "troweprice_direct" },
{ false, SOURCE_SINGLE, "Tradegate, DE", "tradegate" },
{ false, SOURCE_SINGLE, "Treasury Direct bonds, US", "treasurydirect" },
{ false, SOURCE_SINGLE, "Twelve Data", "twelvedata" },
Copy link
Member

Choose a reason for hiding this comment

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

Region?

libgnucash/engine/gnc-commodity.cpp Outdated Show resolved Hide resolved
libgnucash/engine/gnc-commodity.cpp Outdated Show resolved Hide resolved
@bpschuck
Copy link
Contributor

bpschuck commented Oct 19, 2024 via email

@jralls
Copy link
Member

jralls commented Oct 20, 2024

ASX (native method "asx", also advertises "australia") is failing and will be removed in F::Q v1.64.

There are a bunch of Australian GnuCash users of that price source. Please flag that it's got problems on gnucash-user and see if anyone steps up to maintain it.

@bpschuck
Copy link
Contributor

bpschuck commented Oct 20, 2024 via email

Copy link
Contributor Author

@pkryger pkryger left a comment

Choose a reason for hiding this comment

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

ASX (native method "asx", also advertises "australia") is failing and will be removed in F::Q v1.64.

Add @bpschuck: should I remove it with this effort? Or give it some time?

libgnucash/engine/gnc-commodity.cpp Outdated Show resolved Hide resolved
libgnucash/engine/gnc-commodity.cpp Outdated Show resolved Hide resolved
libgnucash/engine/gnc-commodity.cpp Outdated Show resolved Hide resolved
libgnucash/engine/gnc-commodity.cpp Outdated Show resolved Hide resolved
{ false, SOURCE_SINGLE, "Google Web, US Stocks", "googleweb" },
{ false, SOURCE_SINGLE, "India Mutual", "indiamutual" },
{ false, SOURCE_SINGLE, "IEX (Investors Exchange), US", "iexcloud" },
{ false, SOURCE_SINGLE, "Market Watch", "marketwatch" },
Copy link
Contributor Author

@pkryger pkryger Oct 20, 2024

Choose a reason for hiding this comment

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

Yeah - but I was able to find quotes for Japanees, Chineese, Australian, German, UK, and Polish based stocks there. They seem to be positioning themselves similarly to say Bloomberg. Leaving this and other sources that are not clear to me yet as open issues for now.

Let's continue the discussion here

@jralls
Copy link
Member

jralls commented Oct 20, 2024

Separate issue, shouldn't the names be marked for translation?

This seems like a non trivial issue to me

On the surface it's pretty trivial, you just wrap the strings with _(…) and they appear on Weblate and get translated. The fact that several of them are translated from their real names into English is interesting, but not really a problem. It's entirely possible that the translators for their original languages will offer better English translations given the opportunity.

@bpschuck
Copy link
Contributor

On 10/19/24 5:33 PM, John Ralls wrote: ASX (native method "asx", also advertises "australia") is failing and will be removed in F::Q v1.64. There are a bunch of Australian GnuCash users of that price source. Please flag that it's got problems on gnucash-user and see if anyone steps up to maintain it.

There has been an issue opened since May.

The ASX source "sort of" works. It uses 2 different URLs, if the first one fails it tries its second URL. The 1st URL always fails. ASX is utilizing a JavaScript tool called Incapsula. The 2nd URL, while providing basic price data, does not include a trade date. I assumed that since there have been no issues raised on the trade date not being included that there are few users of the module.

@bpschuck
Copy link
Contributor

ASX (native method "asx", also advertises "australia") is failing and will be removed in F::Q v1.64.

Add @bpschuck: should I remove it with this effort? Or give it some time?

@pkryger,

Leave it for now.

However, while doing some cleanup I found IEXCloud has been retired. Definitely will be removed in F::Q v1.64.

"We have retired IEX Cloud. All IEX Cloud products and support concluded on August 31, 2024. To help customers with this transition, we have signed a referral agreement with Intrinio, a full service data management company."

A quick look at Intrinio I did not find free or inexpensive data plans.

@fellen
Copy link
Member

fellen commented Oct 21, 2024

Separate issue, shouldn't the names be marked for translation?

This seems like a non trivial issue to me

On the surface it's pretty trivial, you just wrap the strings with _(…)

My pragmatical view:
We have already 5k+ translatable messages and I see @SziaTomi over a year almost daily work to complete hu.po.
Terms like borsa_italiana would I consider as name, which are usually not translated.
Additionally messages like 'bvb' would require a msgcontext or a translator comment explaining the meaning. We get more overhead than usage.
I18N

@pkryger
Copy link
Contributor Author

pkryger commented Oct 21, 2024

Then SG+, PL+, … would be helpful.

I guess this is source based. While PL+ makes sense for stooq (it covers many Polish funds, that are probably not found in other places, I wouldn't go as far as saying that twelvedata is a Singapore first source. It seems to me they wan't to be a truly mutlinational one, like bloomberg or marketwatch. Granted: the latter two are based in US and US is the biggest financial market in the world, and I think they also have a good coverage of other asset classes (i.e., funds, as well as municipal and company issued bonds). Probably the best in US, but I can see UK pension funds on Bloomberg as well. I'd probably go as far as removing the US from alphavantage.

When I searched symbols of german funds, [...]

Should the regions end up in documentation, perhaps it would warrant adding an extra region column. That way the description can be more verbose, i.e., for stooq it can be something like: PL (primarily), mutlinational. We can even add asset classes (stock, fund, bonds, commodities, crypto, etc.). Perhaps as a separate column as well. But: I don't feel particularly competent or knowledgeable to fill such extra columns.

What's more: what data is provided by each source could change. I could easily see players to add and remove regions and asset classes as they sing and end contracts with other data providers. This is out of control of Finance::Quote, as it merely provides a common interface to these sources. So keeping these columns up to date seems like a never ending task.

Perhaps Wiki is a good place for that, as updating sources should be easier. Maybe even provide a link to the table in Security Editor?

All in all please let me know if I should remove regions from code.

@jralls
Copy link
Member

jralls commented Oct 21, 2024

Should the regions end up in documentation, perhaps it would warrant adding an extra region column. That way the description can be more verbose, i.e., for stooq it can be something like: PL (primarily), mutlinational. We can even add asset classes (stock, fund, bonds, commodities, crypto, etc.). Perhaps as a separate column as well.

In documentation it can be written out in complete sentences like "Stooq: Comprehensive for Polish securities, also provides prices for German, French, UK and US stocks."

But: I don't feel particularly competent or knowledgeable to fill such extra columns.

Another reason for it to be in the wiki instead of the manual, so lots of users can contribute what they've learned about particular sources.

@jralls
Copy link
Member

jralls commented Oct 21, 2024

We have already 5k+ translatable messages and I see @SziaTomi over a year almost daily work to complete hu.po.

It is difficult to respond to that without sarcasm. You're suggesting that we should deliberately make it impossible to translate parts of the UI for what you suppose to be the convenience of translators. @SziaTomi is putting in that work because they want a complete translation of the UI into Hungarian. It seems very unlikely to me that they want you deciding that there are parts that they have to leave in English.

Terms like borsa_italiana would I consider as name, which are usually not translated.
Additionally messages like 'bvb' would require a msgcontext or a translator comment explaining the meaning. We get more overhead than usage.

borsa_italiana and bvb are the internal source-ids that the combo selects. That's code, code doesn't get translated, and you know that. "Borsa Italiana" (which should be rendered in English as "Italian Stock Exchange") and "Bursa de Valori Bucuresti" (similarly "Bucharest Stock Exchange") are the corresponding UI labels that should be English in code and marked for translation just like every other UI string.

@pkryger
Copy link
Contributor Author

pkryger commented Oct 21, 2024

Terms like borsa_italiana would I consider as name, which are usually not translated.
Additionally messages like 'bvb' would require a msgcontext or a translator comment explaining the meaning. We get more overhead than usage.

borsa_italiana and bvb are the internal source-ids that the combo selects. That's code, code doesn't get translated, and you know that. "Borsa Italiana" (which should be rendered in English as "Italian Stock Exchange") and "Bursa de Valori Bucuresti" (similarly "Bucharest Stock Exchange") are the corresponding UI labels that should be English in code and marked for translation just like every other UI string.

My bad - I shouldn't have use quote source names when I ment entity names. But you have answered my question. I updated names in the list to use English names. Also marked strings for translations.

{ false, SOURCE_SINGLE, "Yahoo as JSON", "yahoo_json" },
{ false, SOURCE_SINGLE, "Yahoo Web", "yahooweb" },
{ false, SOURCE_SINGLE, "YH Finance (FinanceAPI)", "financeapi" },
{ false, SOURCE_SINGLE, N_("Alphavantage"), "alphavantage" },
Copy link
Member

Choose a reason for hiding this comment

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

IMHO we should then add a msgcontext, e.g.:
{ false, SOURCE_SINGLE, C_("FQ source", "Alphavantage"), "alphavantage" },

Copy link
Member

Choose a reason for hiding this comment

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

Oops, we need a delay. I fear we have no macro for that defined, @jralls ?

Copy link
Member

Choose a reason for hiding this comment

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

It should call g_dpgettext2 (…) as used in gnucash/gnome/assistant-stock-transaction.cpp.

Copy link
Member

Choose a reason for hiding this comment

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

Oops, we need a delay. I fear we have no macro for that defined, @jralls ?

No worries. The macro comes from glib/gi18n.h and it's already flagged for xgettext.

{ false, SOURCE_SINGLE, C_("FQ source", "Alphavantage"), "alphavantage" },

A poor choice, that's a trademark. Nobody's going to think it's anything else. Likely nobody will translate it, either, considering it's a company name. "Any of the countries are much better exemplars of needing a translation context. But that raises an interesting question: Some of the non-English user names, like Borsa Italiana and Bursa de Valori Bucuresti, are descriptive and should be rendered in English in gnc-commodity.cpp and translated back, but others (FinanzPartners perhaps?) are company names trademarked in their countries; those should be left alone. I suppose that they shouldn't be marked for translation either. Or am I overthinking this?

Copy link
Contributor Author

@pkryger pkryger Oct 22, 2024

Choose a reason for hiding this comment

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

I know that the following is probably mudding waters even more, instead of driving to a solution, but I think it's even more subtle.

When I originally added Borsa Italiana I went to their home pages and it doesn't seem they are encouraging translation of their name. So: is it a trademark that should be left as is?

Some languages that don't use latin script may want to translate names that could be recognised as trademarks. One example could be Commerzbank that could be rendered in Cyrillic script as Коммерцбанк. I know that French, despite using latin script, also like to stick to their own language. But not sure how prolific it is in accounting applications translations.

There's even more. @bpschuck mentioned, that future versions of GnuCash would use dynamically just out of curiosity, how such strings that come from another application, could be translated?

Copy link
Member

Choose a reason for hiding this comment

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

When I originally added Borsa Italiana I went to their home pages and it doesn't seem they are encouraging translation of their name. So: is it a trademark that should be left as is?

The intro on that webpage says "Borsa Italiana has been founded after the privatisation of the exchange" and "from 29th April 2021, Borsa Italiana is part of Euronext Group." So I guess that it is indeed a company name.

You have a good point about translating (or transliterating, but for our purposes there's no difference) for non-Latin scripts. That argues for marking all of them and providing a translator comment on the ones that are company names. I guess that might turn out to be all of them.

You're right that translating strings from another project requires that project to have a message catalog to retrieve the translations from and Finance::Quote at present doesn't. Using methodinfo in GnuCash will require a pretty big design change and (as @bpschuck pointed out in his reply) another piece of that redesign needs to be a way to handle obsolete sources. Let's keep this PR focused on the current design.

@jralls
Copy link
Member

jralls commented Oct 22, 2024

@pkryger

My bad - I shouldn't have use quote source names when I meant entity names.

You didn't, @fellen did.

{ false, SOURCE_SINGLE, "Yahoo as JSON", "yahoo_json" },
{ false, SOURCE_SINGLE, "Yahoo Web", "yahooweb" },
{ false, SOURCE_SINGLE, "YH Finance (FinanceAPI)", "financeapi" },
{ false, SOURCE_SINGLE, C_("FQ Source", "Alphavantage"), "alphavantage" },
Copy link
Member

Choose a reason for hiding this comment

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

No, you want NC_("FQ Source", "Alphavantage"), "alphavantage"
and then you have to search each usage and decide translate it —C_("FQ Source", "…")I think — (shown to the user) or not (stored in the file or log files)

Copy link
Contributor Author

@pkryger pkryger Oct 28, 2024

Choose a reason for hiding this comment

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

I used NC for all as suggested. However, my time has become more limited now and not sure if I will have enough of it to do anything more involved. Because of that constraint if this is not what you've been looking for, I propose to remove the translation markers, merge just the updated list and proceed with translations as a separate PR.

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 so hard: The user name is retrieved in exactly one place, so to perform the translation you need only do

--- a/gnucash/gnome-utils/dialog-commodity.cpp
+++ b/gnucash/gnome-utils/dialog-commodity.cpp
@@ -778,7 +778,7 @@ gnc_ui_source_menu_create(QuoteSourceType type)
             supported = gnc_quote_source_get_supported(source);
             gtk_list_store_append(store, &iter);
             gtk_list_store_set(store, &iter,
-                               SOURCE_COL_NAME, name,
+                               SOURCE_COL_NAME, C_("FQ Source", name),
                                SOURCE_COL_FQ_SUPPORTED, supported,
                                -1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jralls Thanks for explaining this. I think I begin to understand how the i18n works in GTK. I've taken inspiration from 11458bf and used g_dpgettext2 to avoid string concatenation.

@pkryger pkryger force-pushed the update-for-fq-1.63 branch from c8c493a to 4356aa5 Compare October 28, 2024 07:58
@pkryger pkryger force-pushed the update-for-fq-1.63 branch from 4356aa5 to cba8682 Compare October 29, 2024 09:31
@code-gnucash-org code-gnucash-org merged commit 274c033 into Gnucash:stable Oct 31, 2024
4 checks passed
@jralls
Copy link
Member

jralls commented Oct 31, 2024

Thanks!

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.

5 participants