Ejemplo n.º 1
0
static int	s_exec(t_builtin const *builtin, t_proc *p, t_sh *sh)
{
	int		i;

	i = 0;
	if (p->bltin_status == ST_OK)
	{
		while (sh->envp[i])
		{
			ft_putendl_fd(sh->envp[i], STDOUT_FILENO);
			i++;
		}
	}
	else if (p->bltin_status != ST_OK && p->bltin_status != 2)
	{
		ft_putendl_fd(i18n_translate(p->bltin_status), STDERR_FILENO);
		if (p->bltin_status == ST_EINVAL)
		{
			ft_putstr_fd(i18n_translate(ST_USAGE), STDERR_FILENO);
			ft_putstr_fd(": ", STDERR_FILENO);
			ft_putendl_fd(builtin->usage, STDERR_FILENO);
		}
		return (EXIT_FAILURE);
	}
	return (EXIT_SUCCESS);
}
Ejemplo n.º 2
0
int main(int UNUSED(argc), char *UNUSED(argv[]))
{
  z_ucs *path;
  z_ucs german_locale_name[] = { 'd', 'e', '_', 'D', 'E', 0 };

  printf("\nStarting tools-test.\n");

  turn_on_trace();

  if ((path = dup_latin1_string_to_zucs_string("../locales")) == NULL)
    return -1;
  set_i18n_search_path(path);
  free(path);

  register_i18n_stream_output_function(&i18n_test_stream_output);

  printf("\nTrying to display first localized error message:\n ");

  TRACE_LOG("Starting tools_test.\n");

  i18n_translate(
      libfizmo_module_name,
      i18n_libfizmo_COULD_NOT_OPEN_TRACE_FILE_P0S,
      "foo1");

  printf("\n\nTrying to display second localized error message:\n ");

  i18n_translate(
      libfizmo_module_name,
      i18n_libfizmo_INVALID_PARAMETER_TYPE_P0S,
      "foo2");

  if (set_current_locale_name(german_locale_name) != 0)
  {
    printf("set_current_locale_name() failed.\n");
    exit(-1);
  }

  printf("\n\nTrying to display german localized error message:\n ");

  i18n_translate(
      libfizmo_module_name,
      i18n_libfizmo_COULD_NOT_OPEN_TRACE_FILE_P0S,
      "foo1");

  printf("\n");

  TRACE_LOG("End of tools_test.\n");

  printf(
      "\nTools-test finished, you might want to examine \"tracelog.txt\".\n\n");

  return 0;
}
Ejemplo n.º 3
0
void i18n_translate_first_field(struct sbuf *s)
{
	char *tmp, *remainder = NULL, *translation = NULL;

	BUG_ON(!s || !s->buf);
	if (s->buf[0] == '\0')
		return;
	/* Make a copy as we leave 's' untouched if no translation exists */
	tmp = xstrdup(s->buf);
	remainder = strchr(tmp, ',');
	if (remainder) {
		*remainder = '\0';
		++remainder;
	}
	/* tmp now contains the first field, which we want to translate */
	translation = i18n_translate(tmp);
	if (translation) {
		sbuf_cpy(s, translation);
		if (remainder) {
			sbuf_addch(s, ',');
			sbuf_addstr(s, remainder);
		}
	}
	xfree(tmp);
}
Ejemplo n.º 4
0
 const char* tr(const char* str)
 {
   return i18n_translate(str, "tools::gen_multisig");
 }
Ejemplo n.º 5
0
 const char* tr(const char* str)
 {
   return i18n_translate(str, "wallet_args");
 }