如何解决使用 Pango 库将 GtkCalendar Widget Months 翻译成西班牙语
早上好,我目前正在编写一个 GTK+3.0 应用程序,我正在笔记本中显示日历,并且显示正常,但我需要用西班牙语显示月份的 3 个字母缩写。我已经查看了 Pango Docs,但没有资助任何有用的东西,任何帮助将不胜感激。提前致谢。
代码如下:
#include <gtk/gtk.h>
static void destroy (GtkWidget*,gpointer) ;
static gboolean delete_event (GtkWidget*,GdkEvent*,gpointer) ;
static void switch_page(gtkbutton*,GtkNotebook*) ;
int main(int argc,char *argv[])
{
GtkWidget *window,*label,*notebook ;
GtkWidget *label1,*label2,*label3,*label4,*label5,*registro,*calendario,*child3,*child4,*child5 ;
GtkWidget *calendar ;
/* Initialize GTK+ and all its supporting libraries */
gtk_init (&argc,&argv) ;
/* Create a new window,give it a title and display it to the user */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL) ;
gtk_window_set_title(GTK_WINDOW(window),"SVNT Sistema de Vizualizacion de eventos de red");
gtk_container_set_border_width (GTK_CONTAINER (window),10) ;
gtk_widget_set_size_request(window,1024,600);
/* Notebook deFinition */
notebook = gtk_notebook_new() ;
label1 = gtk_label_new ("Registro de Fallecidos") ;
label2 = gtk_label_new ("Calendario") ;
label3 = gtk_label_new ("Contabilidad") ;
label4 = gtk_label_new ("Estadisticas") ;
label5 = gtk_label_new ("Utiles") ;
registro = gtk_label_new ("Aqui se mostrara un formulario para registrar los eventos de red") ;
calendario = gtk_calendar_new () ;
child3 = gtk_label_new ("En esta seccion se llevaran los gastos y las donaciones") ;
child4 = gtk_label_new ("Muestra de Estadisticas ") ;
child5 = gtk_label_new ("Salvas de la base de Datos") ;
/* signal handling*/
/* Connect the main window to the destroy and delete_event signals */
g_signal_connect(G_OBJECT (window),"destroy",G_CALLBACK (destroy),NULL);
g_signal_connect(G_OBJECT (window),"delete_event",G_CALLBACK (delete_event),NULL);
/* notebook signals,note the two tabs are connected to the same signal */
g_signal_connect(G_OBJECT(registro),"clicked",G_CALLBACK(switch_page),(gpointer)notebook) ;
g_signal_connect(G_OBJECT(calendario),(gpointer)notebook) ;
g_signal_connect(G_OBJECT(child3),(gpointer)notebook) ;
g_signal_connect(G_OBJECT(child4),(gpointer)notebook) ;
g_signal_connect(G_OBJECT(child5),(gpointer)notebook) ;
/*Append to pages in notebook container*/
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),registro,label1) ;
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),calendario,label2) ;
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),child3,label3) ;
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),child4,label4) ;
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),child5,label5) ;
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),GTK_POS_TOP);
/* Create a new GtkLabel widget that is selectable */
label = gtk_label_new("hola mundo");
gtk_label_set_selectable(GTK_LABEL(label),FALSE) ;
/* Add the widgets as a children widgets of the main window */
// gtk_container_add(GTK_CONTAINER(window),label);
gtk_container_add(GTK_CONTAINER(window),notebook) ;
gtk_widget_show_all(window) ;
/* Hand control over to the main loop */
gtk_main() ;
return 0 ;
}
/* Switch to the next or prevIoUs GtkNotebook page */
static void switch_page(gtkbutton *button,GtkNotebook *notebook)
{
gint page = gtk_notebook_get_current_page(notebook) ;
if (page == 0)
{
gtk_notebook_set_current_page(notebook,1) ;
}
else
{
gtk_notebook_set_current_page(notebook,0) ;
}
}
/* Stop the GTK+ main loop function when the window is destroyed */
static void destroy(GtkWidget *window,gpointer data)
{
gtk_main_quit();
}
/* Return FALSE to destroy the widget. by returning TRUE,you can cancel
a delete-event. this can be used to confirm quitting the application */
static gboolean delete_event(GtkWidget *window,GdkEvent *event,gpointer data)
{
return FALSE ;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。