Budget UI-how to support i18n?
John Ralls
jralls at ceridwen.fremont.ca.us
Sat Nov 9 15:31:10 EST 2013
On Nov 9, 2013, at 12:09 PM, Robert Ratliff <ratliff.bobby at gmail.com> wrote:
> In src/gnome/gnc-budget-view.c, some strings were hard-coded as part of the new budget UI that Phil Longstaff introduced (https://github.com/Gnucash/gnucash/commit/190665ac2f1c8062d0abd5bdfb714ee048cf6546). Starting at Line 350, The strings are "Income", "Expenses", "Transfers", and "Total". I was wondering how I would go about changing these strings to support i18n. For example, "Income" and "Expenses" are the names of top-level accounts that my account structure came pre-configured with. "Transfers" and "Total" are pretty generic and I'm sure there are already strings for them somewhere.
>
> Where would I look for the translations of these strings and how do I bring them in to this part of the budget UI?
>
> Here's the excerpt from src/gnome/gnc-budget-view.c:
>
> + totals_tree_model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
>
> + gtk_list_store_append(totals_tree_model, &iter);
>
> + gtk_list_store_set(totals_tree_model, &iter, 0, "Income", 1, TOTALS_TYPE_INCOME, -1);
>
> + gtk_list_store_append(totals_tree_model, &iter);
>
> + gtk_list_store_set(totals_tree_model, &iter, 0, "Expenses", 1, TOTALS_TYPE_EXPENSES, -1);
>
> + gtk_list_store_append(totals_tree_model, &iter);
>
> + gtk_list_store_set(totals_tree_model, &iter, 0, "Transfers", 1, TOTALS_TYPE_TRANSFERS, -1);
>
> + gtk_list_store_append(totals_tree_model, &iter);
>
> + gtk_list_store_set(totals_tree_model, &iter, 0, "Total", 1, TOTALS_TYPE_TOTAL, -1);
>
>
It’s pretty simple:
Make sure the file is included in po/POTFILES.in and wrap each string with _(), e.g. _(“Income”). All of the strings except “Transfers” are already in the message catalogs.
Regards,
John Ralls
More information about the gnucash-devel
mailing list