Merge pull request 'master' (#207) from YanTheKaller/ubinstall-gtk:master into master
Reviewed-on: #207pull/239/head
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
@ -0,0 +1,327 @@
|
|||||||
|
|
||||||
|
msgid "UBLinux module the kernel and modules"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module headers and scripts for building modules"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module documentation for the UBLinux kernel"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module firmwares"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes the core developer components"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes basic components Xorg"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes basic fonts"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes graphics accelerators"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes GTK libs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Qt5 and Qt6 libs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes QT5 libs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes QT6 libs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Xfce applications"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes KDE Plasma applications"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes GNOME next generation desktop shell"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes MATE desktop shell"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Pantheon desktop shell"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes GTK applications"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes QT applications"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes GTK and icons themes"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Lightdm display manager"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes multimedia applications"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include system utilites"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include AnyDesk"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include desktop backgrounds"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include blender and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Chromium and some plugins"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes postgresql, mariadb database and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes docker and webmanager and utils"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Brother printer drivers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Canon CAPT Printer Driver"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Canon UFR II LIPSLX CARPS2 printer driver"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Epson printer drivers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Kyocera printer drivers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Lexmark drivers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Pantum printer drivers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include hplip, gutenprint, foomatic"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Ricoh drivers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Samsung drivers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Xerox drivers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes education soft"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Firefox and some plugins"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Java OpenJFX 17 client application platform"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes OpenJDK Java 11 development kit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes OpenJDK Java 17 development kit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes OpenJDK Java 21 development kit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes OpenJDK Java 8 development kit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes some library 32-bit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include LibreOffice"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes dkms additionals modules"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include NVIDIA 470xx driver for linux"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include NVIDIA 390xx driver for linux"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes OnlyOffice suite"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include apps patch"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes podman and webmanager and utils"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include pycharm-community-edition and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes QEMU, manager and utils"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes R7 Office"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes realvnc viewer and server"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes rustdesk"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Telegram"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include UBPile Workflow"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes agents for Linux guest"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes VirtualBox and extension packs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Web servers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Webmin and Usermin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes interactive whiteboard soft"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Winbox"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes wine and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Kingsoft Office (WPS Office) - an office productivity suite"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Yandex Browser and some utils"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module the kernel and modules"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module headers and scripts for building modules for the Meta UBlinux kernel, modules, headers and documentation"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes the core developer components"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Liquidshell basic desktop shell using QtWidgets"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes AMDGRU PRO driver and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes anydesk"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Chromium-GOST and some plugins"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes database applications"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes docker and webmanager and utils"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Hedgewars game similiar to Worms"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Gitea and MemCached"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Gitlab CLI tools"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Java OpenJFX 11 client application platform"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Free Pascal and Lazarus GTK2"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Free Pascal and Lazarus QT5"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes LSI MegaRaid SM, StorCLI, MegaCLI and utils"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes NVIDIA 340xx driver and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes NVIDIA 390xx driver and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes NVIDIA 470xx driver and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes NVIDIA 510xx driver and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes NVIDIA 515xx driver and utilities"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes NVIDIA Optimus"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes OnlyOffice DocumentServer suite"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes Opera and some plugins"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes patch"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes QEMU headless and utils"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include QT4"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include rustdesk-server"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Skype"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Tor utils and browser"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes agents for Linux guest without X support"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes VirtualBox headless and extension packs"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes phpvirtualbox for VirtualBox"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Vivaldi browser"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module includes VMware-Workstation 16"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Wiki.js"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include X11 remote utils"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UBLinux module include Zoom"
|
||||||
|
msgstr ""
|
||||||
|
@ -0,0 +1,332 @@
|
|||||||
|
#include "ubinstall-gtk.h"
|
||||||
|
|
||||||
|
void on_locale_changed(GtkWidget *,main_window *widgets){
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LanguagesTree)),&model,&iter)) return;
|
||||||
|
// {
|
||||||
|
// GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(widgets->InstallerLanguageList),&iter);
|
||||||
|
// gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(widgets->LanguagesTree),path,0,0,0,0);
|
||||||
|
// gtk_tree_path_free(path);
|
||||||
|
// }
|
||||||
|
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter));
|
||||||
|
char *config_code = config(installer_locale_parameter);
|
||||||
|
if (yon_char_is_empty(config_code)){
|
||||||
|
config_code = setlocale(LC_ALL,NULL);
|
||||||
|
}
|
||||||
|
GtkTreeIter itar;
|
||||||
|
for_iter(widgets->InstallerCountryFilter,&iter){
|
||||||
|
gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),&itar,&iter);
|
||||||
|
char *target;
|
||||||
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->InstallerCountryList),&itar,2,&target,-1);
|
||||||
|
if (!strcmp(config_code,target)){
|
||||||
|
gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),&iter,&itar);
|
||||||
|
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CountryLanguagesTree)),&iter);
|
||||||
|
GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(widgets->InstallerCountryFilter),&iter);
|
||||||
|
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(widgets->CountryLanguagesTree),path,0,0,0,0);
|
||||||
|
gtk_tree_path_free(path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_installer_language_changed(GtkWidget *self,GtkTreePath*,GtkTreeViewColumn*, main_window *widgets){
|
||||||
|
char *window_language;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CountryLanguagesTree)),&model,&iter)) return;
|
||||||
|
gtk_tree_model_get(model,&iter,2,&window_language,-1);
|
||||||
|
if (!yon_char_is_empty(window_language)){
|
||||||
|
char *prev_lang = config(installer_locale_parameter);
|
||||||
|
if (!yon_char_is_empty(prev_lang)&&!strcmp(prev_lang,window_language)) return;
|
||||||
|
yon_config_register(installer_locale_parameter,installer_locale_parameter_command,(char*)window_language);
|
||||||
|
}
|
||||||
|
char *active_lang_id = gtk_tree_model_get_string_from_iter(model,&iter);
|
||||||
|
int size;
|
||||||
|
config_str parameters = yon_config_get_save_parameters_by_key(&size,installer_locale_parameter,NULL);
|
||||||
|
char *command_parameters = yon_char_parsed_to_string(parameters,size," ");
|
||||||
|
char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL);
|
||||||
|
if (!system(command)){};
|
||||||
|
yon_main_window_update_locale(widgets);
|
||||||
|
g_signal_handlers_block_by_func(G_OBJECT(self),G_CALLBACK(on_locale_changed),widgets);
|
||||||
|
model = GTK_TREE_MODEL(widgets->InstallerLanguageList);
|
||||||
|
gtk_tree_model_get_iter_from_string(model,&iter,active_lang_id);
|
||||||
|
g_signal_handlers_unblock_by_func(G_OBJECT(self),G_CALLBACK(on_locale_changed),widgets);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void yon_startup_language_init(){
|
||||||
|
char *source = yon_config_get_type_path(main_config.load_mode);
|
||||||
|
if (!source){
|
||||||
|
source = main_config.custom_load_path;
|
||||||
|
}
|
||||||
|
char *command =yon_config_parameter_prepare_command(get_localisation_command,source,NULL,NULL);
|
||||||
|
int size;
|
||||||
|
config_str parsed = yon_config_load(command,&size);
|
||||||
|
{
|
||||||
|
if (size>0&&!yon_char_is_empty(parsed[0])&&strcmp(parsed[0],"(null)\n")){
|
||||||
|
yon_char_remove_last_symbol(parsed[0],'\n');
|
||||||
|
free(yon_char_divide_search(parsed[0],"=",-1));
|
||||||
|
yon_config_register(installer_locale_parameter,installer_locale_parameter_command,parsed[0]);
|
||||||
|
}
|
||||||
|
if (size>1&&!yon_char_is_empty(parsed[1])&&strcmp(parsed[1],"(null)\n")){
|
||||||
|
yon_char_remove_last_symbol(parsed[1],'\n');
|
||||||
|
free(yon_char_divide_search(parsed[1],"=",-1));
|
||||||
|
yon_char_remove_brackets(parsed[1]);
|
||||||
|
yon_config_register(installer_locale_parameter,installer_locale_parameter_command,parsed[1]);
|
||||||
|
}
|
||||||
|
if (size>2&&!yon_char_is_empty(parsed[2])&&strcmp(parsed[2],"(null)\n")){
|
||||||
|
yon_char_remove_last_symbol(parsed[2],'\n');
|
||||||
|
free(yon_char_divide_search(parsed[2],"=",-1));
|
||||||
|
yon_char_remove_brackets(parsed[2]);
|
||||||
|
yon_config_register(installer_locale_parameter,installer_locale_parameter_command,parsed[2]);
|
||||||
|
} else {
|
||||||
|
yon_config_register(installer_locale_parameter,installer_locale_parameter_command,setlocale(LC_ALL,""));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void yon_main_window_update_locale(main_window *widgets){
|
||||||
|
char *locale = config(installer_locale_parameter);
|
||||||
|
if (yon_char_is_empty(locale)){
|
||||||
|
char *sys_locale = config(lang_parameter);
|
||||||
|
|
||||||
|
if (!yon_char_is_empty(sys_locale)){
|
||||||
|
locale = sys_locale;
|
||||||
|
} else {
|
||||||
|
char *lang = config("LANG");
|
||||||
|
if (!yon_char_is_empty(lang)){
|
||||||
|
locale = lang;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
locale = setlocale(LC_ALL,locale);
|
||||||
|
yon_config_register(installer_locale_parameter,installer_locale_parameter_command,(char*)locale);
|
||||||
|
|
||||||
|
// gtk_widget_destroy(widgets->MainWindow);
|
||||||
|
textdomain(LocaleName);
|
||||||
|
g_setenv("LANGUAGE",locale,1);
|
||||||
|
yon_update_translation(widgets);
|
||||||
|
// yon_main_window_create(widgets);
|
||||||
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
||||||
|
yon_window_config_setup(GTK_WINDOW(widgets->MainWindow));
|
||||||
|
yon_window_config_load(path);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
char *locale_name;
|
||||||
|
char *code;
|
||||||
|
char *localised_name;
|
||||||
|
char *code_full;
|
||||||
|
} locale_struct;
|
||||||
|
|
||||||
|
gboolean on_languages_search_func(GtkTreeModel *model, gint ,const char *key, GtkTreeIter *iter, main_window *){
|
||||||
|
char *target;
|
||||||
|
char *loc_target;
|
||||||
|
gtk_tree_model_get(model, iter, 1,&target, 4, &loc_target,-1);
|
||||||
|
char *string_utf = g_utf8_casefold(key,-1);
|
||||||
|
char *target_utf = g_utf8_casefold(target,-1);
|
||||||
|
char *loc_target_utf = g_utf8_casefold(loc_target,-1);
|
||||||
|
|
||||||
|
char *string_normalized = g_utf8_strdown(g_utf8_normalize(string_utf,-1,G_NORMALIZE_DEFAULT),-1);
|
||||||
|
char *target_normalized = g_utf8_strdown(g_utf8_normalize(target_utf,-1,G_NORMALIZE_DEFAULT),-1);
|
||||||
|
char *loc_target_normalized = g_utf8_strdown(g_utf8_normalize(loc_target_utf,-1,G_NORMALIZE_DEFAULT),-1);
|
||||||
|
|
||||||
|
return !(g_str_has_prefix(target_normalized,string_normalized) || g_str_has_prefix(loc_target_normalized,string_normalized));
|
||||||
|
}
|
||||||
|
|
||||||
|
void yon_set_locales_list(main_window *widgets){
|
||||||
|
gtk_list_store_clear(widgets->InstallerLanguageList);
|
||||||
|
gtk_list_store_clear(widgets->InstallerCountryList);
|
||||||
|
|
||||||
|
char *config_code = yon_char_new(config(installer_locale_parameter));
|
||||||
|
int size;
|
||||||
|
config_str locales = yon_locale_get_all_codes(&size);
|
||||||
|
qsort(locales,size,sizeof(char*),(__compar_fn_t)yon_char_parsed_compare);
|
||||||
|
GtkTreeIter iter,itar;
|
||||||
|
GHashTable *added = g_hash_table_new(g_str_hash,g_str_equal);
|
||||||
|
textdomain(LOCALES_DOMAIN_NAME);
|
||||||
|
for (int i=0;i<size;i++){
|
||||||
|
char *lang_ab = yon_locale_get_parameter(locales[i],YON_LOCALE_LANG_AB);
|
||||||
|
char *code = yon_locale_get_parameter(locales[i],YON_LOCALE_CODE);
|
||||||
|
char *language = yon_locale_get_parameter(locales[i],YON_LOCALE_LANGUAGE);
|
||||||
|
char *lang_name = yon_locale_get_parameter(locales[i],YON_LOCALE_LANG_NAME);
|
||||||
|
char *territory = yon_locale_get_parameter(locales[i],YON_LOCALE_TERRITORY);
|
||||||
|
char *title = yon_locale_get_parameter(locales[i],YON_LOCALE_TITLE);
|
||||||
|
if (yon_char_is_empty(lang_ab)||
|
||||||
|
yon_char_is_empty(language)||
|
||||||
|
yon_char_is_empty(lang_name)||
|
||||||
|
yon_char_is_empty(territory)||
|
||||||
|
yon_char_is_empty(title)) continue;
|
||||||
|
|
||||||
|
char *country = yon_char_unite(language,", ",territory,NULL);
|
||||||
|
if (!g_hash_table_contains(added,lang_ab)){
|
||||||
|
g_hash_table_add(added,yon_char_new(lang_ab));
|
||||||
|
gtk_list_store_append(widgets->InstallerLanguageList,&iter);
|
||||||
|
gtk_list_store_set(widgets->InstallerLanguageList,&iter,
|
||||||
|
0,lang_ab,
|
||||||
|
1,_(language),
|
||||||
|
2,lang_name,
|
||||||
|
3,locales[i],
|
||||||
|
4,language,
|
||||||
|
-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_list_store_append(widgets->InstallerCountryList,&itar);
|
||||||
|
gtk_list_store_set(widgets->InstallerCountryList,&itar,
|
||||||
|
0,lang_ab,
|
||||||
|
1,_(country),
|
||||||
|
2,code,
|
||||||
|
3,_(title),
|
||||||
|
-1);
|
||||||
|
}
|
||||||
|
for_iter (GTK_TREE_MODEL(widgets->InstallerLanguageList), &iter){
|
||||||
|
char *compare_target;
|
||||||
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->InstallerLanguageList),&iter, 3, &compare_target, -1);
|
||||||
|
if (!yon_char_is_empty(config_code)){
|
||||||
|
char *temp = strstr(config_code,".");
|
||||||
|
if (temp) temp[0]='\0';
|
||||||
|
char *compare_lang_ab =yon_locale_get_parameter(compare_target,YON_LOCALE_LANG_AB);
|
||||||
|
temp = strstr(config_code,"_");
|
||||||
|
if (temp) temp[0]='\0';
|
||||||
|
if (!strcmp(config_code,compare_lang_ab)){
|
||||||
|
gtk_widget_realize(widgets->LanguagesTree);
|
||||||
|
GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(widgets->InstallerLanguageList),&iter);
|
||||||
|
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(widgets->LanguagesTree),path,0,0,0,0);
|
||||||
|
gtk_tree_path_free(path);
|
||||||
|
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LanguagesTree)),&iter);
|
||||||
|
on_locale_changed(NULL,widgets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
textdomain(LocaleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean on_country_filter(GtkTreeModel *self, GtkTreeIter *iter, main_window *widgets){
|
||||||
|
GtkTreeIter itar;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LanguagesTree)),&model,&itar)) return 0;
|
||||||
|
char *cur_code,*country;
|
||||||
|
gtk_tree_model_get(self,iter,0,&cur_code,1,&country,-1);
|
||||||
|
if (yon_char_is_empty(cur_code)) return 0;
|
||||||
|
|
||||||
|
char *code;
|
||||||
|
gtk_tree_model_get(model,&itar,0,&code,-1);
|
||||||
|
if (!strcmp(code,cur_code)){
|
||||||
|
char *config_lang = config(installer_locale_parameter);
|
||||||
|
if (!yon_char_is_empty(config_lang)&&!strcmp(cur_code,config_lang)){
|
||||||
|
if (gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),iter,&itar)){
|
||||||
|
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CountryLanguagesTree)),&itar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void yon_translation_init(GtkBuilder *builder){
|
||||||
|
|
||||||
|
GSList *list = gtk_builder_get_objects(builder);
|
||||||
|
GSList *iter;
|
||||||
|
for (iter = list; iter; iter = iter->next){
|
||||||
|
GObject *cur_widget = NULL;
|
||||||
|
const char *widget_text = NULL;
|
||||||
|
if (GTK_IS_BUTTON(iter->data)){
|
||||||
|
cur_widget = G_OBJECT(iter->data);
|
||||||
|
widget_text = yon_char_new(gtk_button_get_label(GTK_BUTTON(cur_widget)));
|
||||||
|
} else if (GTK_IS_LABEL(iter->data)){
|
||||||
|
cur_widget = G_OBJECT(iter->data);
|
||||||
|
widget_text = yon_char_new(gtk_label_get_label(GTK_LABEL(cur_widget)));
|
||||||
|
} else if (GTK_IS_TREE_VIEW_COLUMN(iter->data)){
|
||||||
|
cur_widget = G_OBJECT(iter->data);
|
||||||
|
widget_text = yon_char_new(gtk_tree_view_column_get_title(GTK_TREE_VIEW_COLUMN(cur_widget)));
|
||||||
|
} else if (GTK_IS_MENU_ITEM(iter->data)){
|
||||||
|
cur_widget = G_OBJECT(iter->data);
|
||||||
|
GList *list = gtk_container_get_children(GTK_CONTAINER(cur_widget));
|
||||||
|
if (list) {
|
||||||
|
GtkWidget *widget = list->data;
|
||||||
|
g_list_free(list);
|
||||||
|
if (GTK_IS_BOX(widget)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
widget_text = yon_char_new(gtk_menu_item_get_label(GTK_MENU_ITEM(cur_widget)));
|
||||||
|
} else continue;
|
||||||
|
g_object_set_data(G_OBJECT(cur_widget),"original_label",(void*)widget_text);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void yon_update_translation(main_window *widgets){
|
||||||
|
GtkBuilder *builder = widgets->builder;
|
||||||
|
GSList *list = gtk_builder_get_objects(builder);
|
||||||
|
list = g_slist_append(list,widgets->DocumentationMenuItem);
|
||||||
|
list = g_slist_append(list,widgets->AboutMenuItem);
|
||||||
|
GSList *iter;
|
||||||
|
for (iter = list; iter; iter = iter->next){
|
||||||
|
if (iter->data == widgets->LicenceLabel){
|
||||||
|
yon_licence_load(widgets);
|
||||||
|
} else if (GTK_IS_BUTTON(iter->data)){
|
||||||
|
GtkWidget *cur_button = GTK_WIDGET(iter->data);
|
||||||
|
char *source_label = g_object_get_data(G_OBJECT(cur_button),"original_label");
|
||||||
|
if (!yon_char_is_empty(source_label)){
|
||||||
|
gtk_button_set_label(GTK_BUTTON(cur_button),_(source_label));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (GTK_IS_LABEL(iter->data)){
|
||||||
|
GtkWidget *cur_label = GTK_WIDGET(iter->data);
|
||||||
|
char *source_label = g_object_get_data(G_OBJECT(cur_label),"original_label");
|
||||||
|
if (!yon_char_is_empty(source_label)){
|
||||||
|
if (gtk_label_get_use_markup(GTK_LABEL(cur_label))){
|
||||||
|
gtk_label_set_markup(GTK_LABEL(cur_label),_(source_label));
|
||||||
|
} else {
|
||||||
|
gtk_label_set_text(GTK_LABEL(cur_label),_(source_label));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (GTK_IS_MENU_ITEM(iter->data)){
|
||||||
|
GtkWidget *cur_menu_item = GTK_WIDGET(iter->data);
|
||||||
|
char *source_label = g_object_get_data(G_OBJECT(cur_menu_item),"original_label");
|
||||||
|
if (!yon_char_is_empty(source_label)){
|
||||||
|
gtk_menu_item_set_label(GTK_MENU_ITEM(cur_menu_item),_(source_label));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (GTK_IS_TREE_VIEW_COLUMN(iter->data)){
|
||||||
|
GObject *cur_column = G_OBJECT(iter->data);
|
||||||
|
char *source_label = g_object_get_data(G_OBJECT(cur_column),"original_label");
|
||||||
|
if (!yon_char_is_empty(source_label)){
|
||||||
|
gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(cur_column),_(source_label));
|
||||||
|
}
|
||||||
|
} else if (iter->data == widgets->LanguagesTree){
|
||||||
|
yon_set_locales_list(widgets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->DocumentationMenuItem));
|
||||||
|
GList *container = gtk_container_get_children(list->data);
|
||||||
|
|
||||||
|
GObject *cur_button = G_OBJECT(container->next->data);
|
||||||
|
char *source_label = g_object_get_data(G_OBJECT(widgets->DocumentationMenuItem),"original_label");
|
||||||
|
if (!yon_char_is_empty(source_label)){
|
||||||
|
gtk_label_set_text(GTK_LABEL(cur_button),_(source_label));
|
||||||
|
}
|
||||||
|
g_list_free(list);
|
||||||
|
g_list_free(container);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AboutMenuItem));
|
||||||
|
GList *container = gtk_container_get_children(list->data);
|
||||||
|
|
||||||
|
GObject *cur_button = G_OBJECT(container->next->data);
|
||||||
|
char *source_label = g_object_get_data(G_OBJECT(widgets->AboutMenuItem),"original_label");
|
||||||
|
if (!yon_char_is_empty(source_label)){
|
||||||
|
gtk_label_set_text(GTK_LABEL(cur_button),_(source_label));
|
||||||
|
}
|
||||||
|
g_list_free(list);
|
||||||
|
g_list_free(container);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.40.0 -->
|
||||||
|
<interface domain="ubinstall-gtk">
|
||||||
|
<requires lib="gtk+" version="3.24"/>
|
||||||
|
<!-- interface-css-provider-path ubinstall-gtk.css -->
|
||||||
|
<object class="GtkListStore" id="InfoList">
|
||||||
|
<columns>
|
||||||
|
<!-- column-name Name -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
<!-- column-name Value -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
</columns>
|
||||||
|
</object>
|
||||||
|
<object class="GtkBox" id="MainBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow" id="InfoTree">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeView">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="model">InfoList</property>
|
||||||
|
<property name="headers-visible">False</property>
|
||||||
|
<property name="enable-search">False</property>
|
||||||
|
<property name="enable-grid-lines">both</property>
|
||||||
|
<child internal-child="selection">
|
||||||
|
<object class="GtkTreeSelection">
|
||||||
|
<property name="mode">none</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn">
|
||||||
|
<property name="title" translatable="yes">column</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="markup">0</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn">
|
||||||
|
<property name="title" translatable="yes">column</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText">
|
||||||
|
<property name="wrap-mode">word</property>
|
||||||
|
<property name="wrap-width">150</property>
|
||||||
|
</object>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="markup">1</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||