Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
intl: more string fixes (debugging, DVR state)
  • Loading branch information
perexg committed Jun 23, 2015
1 parent 444654c commit 007aa4d
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -512,7 +512,7 @@ reconfigure:
$(ROOTDIR)/configure $(CONFIGURE_ARGS)

# Binary
${PROG}: check_config make_webui $(MO-FILES) $(OBJS)
${PROG}: check_config make_webui $(OBJS)
$(CC) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS)

# Object
Expand Down
7 changes: 4 additions & 3 deletions src/api/api_idnode.c
Expand Up @@ -60,7 +60,7 @@ static struct strtab filtcmptab[] = {

static void
api_idnode_grid_conf
( htsmsg_t *args, api_idnode_grid_conf_t *conf )
( access_t *perm, htsmsg_t *args, api_idnode_grid_conf_t *conf )
{
htsmsg_field_t *f, *f2;
htsmsg_t *filter, *e;
Expand Down Expand Up @@ -104,6 +104,7 @@ api_idnode_grid_conf
}

/* Sort */
conf->sort.lang = perm->aa_lang;
if ((str = htsmsg_get_str(args, "sort"))) {
conf->sort.key = str;
if ((str = htsmsg_get_str(args, "dir")) && !strcasecmp(str, "DESC"))
Expand All @@ -127,7 +128,7 @@ api_idnode_grid
api_idnode_grid_callback_t cb = opaque;

/* Grid configuration */
api_idnode_grid_conf(args, &conf);
api_idnode_grid_conf(perm, args, &conf);

/* Create list */
pthread_mutex_lock(&global_lock);
Expand All @@ -144,7 +145,7 @@ api_idnode_grid
htsmsg_add_str(e, "uuid", idnode_uuid_as_str(ins.is_array[i]));
in = ins.is_array[i];
idnode_perm_set(in, perm);
idnode_read0(in, e, flist, 0);
idnode_read0(in, e, flist, 0, perm->aa_lang);
idnode_perm_unset(in);
htsmsg_add_msg(list, NULL, e);
if (conf.limit > 0) conf.limit--;
Expand Down
6 changes: 3 additions & 3 deletions src/dvr/dvr_db.c
Expand Up @@ -315,10 +315,10 @@ dvr_entry_status(dvr_entry_t *de)
return N_("Completed OK");

case DVR_MISSED_TIME:
return "Time missed";
return N_("Time missed");

default:
return "Invalid";
return N_("Invalid");
}
}

Expand Down Expand Up @@ -2274,7 +2274,7 @@ const idclass_t dvr_entry_class = {
.id = "status",
.name = N_("Status"),
.get = dvr_entry_class_status_get,
.opts = PO_RDONLY | PO_NOSAVE,
.opts = PO_RDONLY | PO_NOSAVE | PO_LOCALE,
},
{
.type = PT_STR,
Expand Down
5 changes: 3 additions & 2 deletions src/idnode.c
Expand Up @@ -1112,11 +1112,12 @@ idnode_changed( idnode_t *self )
* *************************************************************************/

void
idnode_read0 ( idnode_t *self, htsmsg_t *c, htsmsg_t *list, int optmask )
idnode_read0 ( idnode_t *self, htsmsg_t *c, htsmsg_t *list,
int optmask, const char *lang )
{
const idclass_t *idc = self->in_class;
for (; idc; idc = idc->ic_super)
prop_read_values(self, idc->ic_properties, c, list, optmask);
prop_read_values(self, idc->ic_properties, c, list, optmask, lang);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/idnode.h
Expand Up @@ -193,13 +193,13 @@ const idclass_t *idclass_find ( const char *name );
const char *idclass_get_caption ( const idclass_t *idc, const char *lang );
htsmsg_t *idclass_serialize0 (const idclass_t *idc, htsmsg_t *list, int optmask, const char *lang);
htsmsg_t *idnode_serialize0 (idnode_t *self, htsmsg_t *list, int optmask, const char *lang);
void idnode_read0 (idnode_t *self, htsmsg_t *m, htsmsg_t *list, int optmask);
void idnode_read0 (idnode_t *self, htsmsg_t *m, htsmsg_t *list, int optmask, const char *lang);
int idnode_write0 (idnode_t *self, htsmsg_t *m, int optmask, int dosave);

#define idclass_serialize(idc, lang) idclass_serialize0(idc, NULL, 0, lang)
#define idnode_serialize(in, lang) idnode_serialize0(in, NULL, 0, lang)
#define idnode_load(in, m) idnode_write0(in, m, PO_NOSAVE, 0)
#define idnode_save(in, m) idnode_read0(in, m, NULL, PO_NOSAVE | PO_USERAW)
#define idnode_save(in, m) idnode_read0(in, m, NULL, PO_NOSAVE | PO_USERAW, NULL)
#define idnode_update(in, m) idnode_write0(in, m, PO_RDONLY | PO_WRONCE, 1)

int idnode_perm(idnode_t *self, struct access *a, htsmsg_t *msg_to_write);
Expand Down
17 changes: 10 additions & 7 deletions src/prop.c
Expand Up @@ -22,6 +22,7 @@

#include "tvheadend.h"
#include "prop.h"
#include "tvh_locale.h"
#include "lang_str.h"

/* **************************************************************************
Expand Down Expand Up @@ -246,7 +247,8 @@ prop_write_values
*/
static void
prop_read_value
(void *obj, const property_t *p, htsmsg_t *m, const char *name, int optmask)
(void *obj, const property_t *p, htsmsg_t *m, const char *name,
int optmask, const char *lang)
{
const char *s;
const void *val = obj + p->off;
Expand Down Expand Up @@ -309,7 +311,7 @@ prop_read_value
break;
case PT_STR:
if ((s = *(const char **)val))
htsmsg_add_str(m, name, s);
htsmsg_add_str(m, name, lang ? tvh_gettext_lang(lang, s) : s);
break;
case PT_DBL:
htsmsg_add_dbl(m, name, *(double*)val);
Expand All @@ -335,14 +337,15 @@ prop_read_value
*/
void
prop_read_values
(void *obj, const property_t *pl, htsmsg_t *m, htsmsg_t *list, int optmask)
(void *obj, const property_t *pl, htsmsg_t *m, htsmsg_t *list,
int optmask, const char *lang)
{
if(pl == NULL)
return;

if(list == NULL) {
for (; pl->id; pl++)
prop_read_value(obj, pl, m, pl->id, optmask);
prop_read_value(obj, pl, m, pl->id, optmask, lang);
} else {
const property_t *p;
htsmsg_field_t *f;
Expand All @@ -354,7 +357,7 @@ prop_read_values
if (b > 0) {
p = prop_find(pl, f->hmf_name);
if (p)
prop_read_value(obj, p, m, p->id, optmask);
prop_read_value(obj, p, m, p->id, optmask, lang);
count++;
}
}
Expand All @@ -365,7 +368,7 @@ prop_read_values
if (!strcmp(pl->id, f->hmf_name))
break;
if (f == NULL)
prop_read_value(obj, pl, m, pl->id, optmask);
prop_read_value(obj, pl, m, pl->id, optmask, lang);
}
}
}
Expand Down Expand Up @@ -485,7 +488,7 @@ prop_serialize_value

/* Data */
if (obj)
prop_read_value(obj, pl, m, "value", optmask);
prop_read_value(obj, pl, m, "value", optmask, lang);

htsmsg_add_msg(msg, NULL, m);
}
Expand Down
4 changes: 3 additions & 1 deletion src/prop.h
Expand Up @@ -56,6 +56,7 @@ typedef enum {
#define PO_DURATION 0x0100 // For PT_TIME - differentiate between duration and datetime
#define PO_HEXA 0x0200 // Hexadecimal value
#define PO_DATE 0x0400 // Show date only
#define PO_LOCALE 0x0800 // Call tvh_locale_lang on string

/*
* Property definition
Expand Down Expand Up @@ -105,7 +106,8 @@ int prop_write_values
(void *obj, const property_t *pl, htsmsg_t *m, int optmask, htsmsg_t *updated);

void prop_read_values
(void *obj, const property_t *pl, htsmsg_t *m, htsmsg_t *list, int optmask);
(void *obj, const property_t *pl, htsmsg_t *m, htsmsg_t *list,
int optmask, const char *lang);

void prop_serialize
(void *obj, const property_t *pl, htsmsg_t *m, htsmsg_t *list,
Expand Down
2 changes: 1 addition & 1 deletion src/webui/static/app/idnode.js
Expand Up @@ -527,7 +527,7 @@ tvheadend.idnode_editor_field = function(f, conf)
typeAhead: true, // TODO: this does strange things in multi
forceSelection: false,
triggerAction: 'all',
emptyText: 'Select ' + f.caption + ' ...',
emptyText: _('Select {0} ...').replace('{0}', f.caption),
listeners: {
beforequery: function(qe) {
delete qe.combo.lastQuery;
Expand Down
30 changes: 15 additions & 15 deletions src/webui/static/app/tvhlog.js
Expand Up @@ -12,39 +12,39 @@ tvheadend.tvhlog = function(panel, index) {
* ***************************************************************/

var tvhlogLogPath = new Ext.form.TextField({
fieldLabel: 'Debug log path',
fieldLabel: _('Debug log path'),
name: 'tvhlog_path',
allowBlank: true,
width: 400
});

var tvhlogToSyslog = new Ext.form.Checkbox({
name: 'tvhlog_dbg_syslog',
fieldLabel: 'Debug to syslog'
fieldLabel: _('Debug to syslog')
});

var tvhlogTraceOn = new Ext.form.Checkbox({
name: 'tvhlog_trace_on',
fieldLabel: 'Debug trace (low-level stuff)'
fieldLabel: _('Debug trace (low-level stuff)')
});

var tvhlogDebugSubsys = new Ext.form.TextField({
fieldLabel: 'Debug subsystems',
fieldLabel: _('Debug subsystems'),
name: 'tvhlog_debug',
allowBlank: true,
width: 400
});

var tvhlogTraceSubsys = new Ext.form.TextField({
fieldLabel: 'Trace subsystems',
fieldLabel: _('Trace subsystems'),
name: 'tvhlog_trace',
allowBlank: true,
width: 400
});

var tvhlogLibav = new Ext.form.Checkbox({
name: 'tvhlog_libav',
fieldLabel: 'Debug libav log'
fieldLabel: _('Debug libav log')
});


Expand All @@ -53,17 +53,17 @@ tvheadend.tvhlog = function(panel, index) {
* ***************************************************************/

var saveButton = new Ext.Button({
text: "Apply configuration (run-time only)",
tooltip: 'Apply changes made bellow to the run-time configuration<br/>They will be lost on restart.',
text: _("Apply configuration (run-time only)"),
tooltip: _('Apply changes made bellow to the run-time configuration<br/>They will be lost on restart.'),
iconCls: 'apply',
handler: saveChanges
});

var helpButton = new Ext.Button({
text: 'Help',
iconCls: 'help',
text: _('Help'),
iconCls: 'help',
handler: function() {
new tvheadend.help('Debug Configuration', 'config_debugging.html');
new tvheadend.help(_('Debug Configuration'), 'config_debugging.html');
}
});

Expand All @@ -79,7 +79,7 @@ tvheadend.tvhlog = function(panel, index) {
items.push(tvhlogLibav);

var DebuggingPanel = new Ext.form.FieldSet({
title: 'Debugging Options',
title: _('Debugging Options'),
width: 700,
autoHeight: true,
collapsible: true,
Expand All @@ -88,7 +88,7 @@ tvheadend.tvhlog = function(panel, index) {
});

var confpanel = new Ext.form.FormPanel({
title: 'Debugging',
title: _('Debugging'),
iconCls: 'debug',
border: false,
bodyStyle: 'padding:15px',
Expand Down Expand Up @@ -125,9 +125,9 @@ tvheadend.tvhlog = function(panel, index) {
params: {
op: 'saveSettings'
},
waitMsg: 'Applying Data...',
waitMsg: _('Applying Data...'),
failure: function(form, action) {
Ext.Msg.alert('Apply failed', action.result.errormsg);
Ext.Msg.alert(_('Apply failed'), action.result.errormsg);
}
});
}
Expand Down

0 comments on commit 007aa4d

Please sign in to comment.