/* gettext.c - gettext module */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
GRUB_MOD_LICENSE ("GPLv3+");
/*
.mo file information from:
*/
static int grub_gettext_offsetoriginal;
static int grub_gettext_max;
static const char *(*grub_gettext_original) (const char *s);
struct grub_gettext_msg
{
const char *name;
const char *translated;
};
#define GETTEXT_MAGIC_NUMBER 0
static grub_ssize_t
{
{
return -1;
}
}
static grub_uint32_t
{
return value;
}
static void
{
}
static const char *
{
int offsettranslation;
int internal_position;
char *translation;
return translation;
}
static char *
{
int internal_position;
char *original;
/* Get position for string i. */
/* Get the length of the string i. */
/* Get the offset of the string i. */
/* Get the string i. */
return original;
}
static const char *
{
char *current_string;
const char *ret;
int found = 0;
/* Make sure we can use grub_gettext_translate for error messages. Push
active error message to error stack and reset error message. */
grub_error_push ();
orig);
if (cur)
{
grub_error_pop ();
return cur->translated;
}
if (fd_mo == 0)
{
grub_error_pop ();
return orig;
}
min = 0;
{
/* Search by bisection. */
{
}
{
}
{
found = 1;
}
}
if (found)
{
if (cur)
{
{
GRUB_AS_LIST (cur));
}
}
else
}
grub_error_pop ();
return ret;
}
/* This is similar to grub_file_open. */
static grub_file_t
{
int unsigned magic;
int version;
/* Using fd_mo and not another variable because
it's needed for grub_gettext_get_info. */
if (!fd_mo)
{
return 0;
}
if (magic != MO_MAGIC_NUMBER)
{
filename);
fd_mo = 0;
return 0;
}
if (version != 0)
{
"mo: invalid mo version in file: %s", filename);
fd_mo = 0;
return 0;
}
return fd_mo;
}
/* Returning grub_file_t would be more natural, but grub_mofile_open assigns
to fd_mo anyway ... */
static void
{
char *mo_file;
if (!mo_file)
return;
/* Will try adding .gz as well. */
{
char *mo_file_old;
if (!mo_file)
return;
}
}
static void
{
const char *locale_dir;
if (!locale)
return;
if (locale_dir == NULL)
{
return;
}
/* ll_CC didn't work, so try ll. */
{
if (underscore)
{
*underscore = '\0';
}
}
if (fd_mo)
{
}
}
static void
grub_gettext_delete_list (void)
{
while (grub_gettext_msg_list)
{
/* Don't delete the translated message because could be in use. */
}
}
static char *
{
return grub_strdup (val);
}
static grub_err_t
{
if (argc != 1)
const char *translation;
return 0;
}
{
const char *lang;
N_("STRING"),
N_("Translates the string with the current settings."));
/* Reload .mo file information if lang changes. */
/* Preserve hooks after context changes. */
grub_env_export ("lang");
}
{
if (fd_mo != 0)
}