// swad_language.c: user's settings on language /* SWAD (Shared Workspace At a Distance), is a web platform developed at the University of Granada (Spain), and used to support university teaching. This file is part of SWAD core. Copyright (C) 1999-2019 Antonio Caņas Vargas This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ /*****************************************************************************/ /********************************** Headers **********************************/ /*****************************************************************************/ #include "swad_box.h" #include "swad_database.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_language.h" #include "swad_setting.h" /*****************************************************************************/ /*************** External global variables from others modules ***************/ /*****************************************************************************/ extern struct Globals Gbl; /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES] = // ISO 639-1 language codes { "", // Lan_LANGUAGE_UNKNOWN "ca", // Lan_LANGUAGE_CA "de", // Lan_LANGUAGE_DE "en", // Lan_LANGUAGE_EN "es", // Lan_LANGUAGE_ES "fr", // Lan_LANGUAGE_FR "gn", // Lan_LANGUAGE_GN "it", // Lan_LANGUAGE_IT "pl", // Lan_LANGUAGE_PL "pt", // Lan_LANGUAGE_PT }; /*****************************************************************************/ /****************************** Private constants ****************************/ /*****************************************************************************/ /*****************************************************************************/ /****************************** Private prototypes ***************************/ /*****************************************************************************/ static void Lan_PutIconsLanguage (void); static void Lan_PutParamLanguage (void); /*****************************************************************************/ /*************** Put link to change language (edit settings) *****************/ /*****************************************************************************/ void Lan_PutLinkToChangeLanguage (void) { Lay_PutContextualLinkIconText (ActReqEdiSet,NULL,NULL, "globe.svg", "Change language"); } /*****************************************************************************/ /************** Put a selector to select language in settings ****************/ /*****************************************************************************/ void Lan_PutBoxToSelectLanguage (void) { extern const char *Hlp_PROFILE_Settings_language; extern const char *Txt_Language; Box_BoxBegin (NULL,Txt_Language,Lan_PutIconsLanguage, Hlp_PROFILE_Settings_language,Box_NOT_CLOSABLE); Lan_PutSelectorToSelectLanguage (); Box_BoxEnd (); } /*****************************************************************************/ /**************** Put contextual icons in language setting *******************/ /*****************************************************************************/ static void Lan_PutIconsLanguage (void) { /***** Put icon to show a figure *****/ Gbl.Figures.FigureType = Fig_LANGUAGES; Fig_PutIconToShowFigure (); } /*****************************************************************************/ /********************* Put a selector to select language *********************/ /*****************************************************************************/ void Lan_PutSelectorToSelectLanguage (void) { extern const char *Txt_STR_LANG_NAME[1 + Lan_NUM_LANGUAGES]; Lan_Language_t Lan; Frm_StartForm (ActReqChgLan); fprintf (Gbl.F.Out,"