| 270 | */ |
| 271 | |
| 272 | const char * /* O - Localized string */ |
| 273 | cupsLocalizeDestValue( |
| 274 | http_t *http, /* I - Connection to destination */ |
| 275 | cups_dest_t *dest, /* I - Destination */ |
| 276 | cups_dinfo_t *dinfo, /* I - Destination information */ |
| 277 | const char *option, /* I - Option to localize */ |
| 278 | const char *value) /* I - Value to localize */ |
| 279 | { |
| 280 | _cups_message_t key, /* Search key */ |
| 281 | *match; /* Matching entry */ |
| 282 | char pair[256]; /* option.value pair */ |
| 283 | const char *localized; /* Localized string */ |
| 284 | |
| 285 | |
| 286 | DEBUG_printf(("cupsLocalizeDestValue(http=%p, dest=%p, dinfo=%p, option=\"%s\", value=\"%s\")", (void *)http, (void *)dest, (void *)dinfo, option, value)); |
| 287 | |
| 288 | if (!http || !dest || !dinfo) |
| 289 | return (value); |
| 290 | |
| 291 | if (!strcmp(option, "media")) |
| 292 | { |
| 293 | pwg_media_t *media = pwgMediaForPWG(value); |
| 294 | cups_size_t size; |
| 295 | |
| 296 | strlcpy(size.media, value, sizeof(size.media)); |
| 297 | size.width = media ? media->width : 0; |
| 298 | size.length = media ? media->length : 0; |
| 299 | size.left = 0; |
| 300 | size.right = 0; |
| 301 | size.bottom = 0; |
| 302 | size.top = 0; |
| 303 | |
| 304 | return (cupsLocalizeDestMedia(http, dest, dinfo, CUPS_MEDIA_FLAGS_DEFAULT, &size)); |
| 305 | } |
| 306 | |
| 307 | if (!dinfo->localizations) |
| 308 | cups_create_localizations(http, dinfo); |
| 309 | |
| 310 | snprintf(pair, sizeof(pair), "%s.%s", option, value); |
| 311 | key.msg = pair; |
| 312 | if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations, &key)) != NULL) |
| 313 | return (match->str); |
| 314 | else if ((localized = _cupsLangString(cupsLangDefault(), pair)) != NULL && strcmp(localized, pair)) |
| 315 | return (localized); |
| 316 | else |
| 317 | return (value); |
| 318 | } |
| 319 | |
| 320 | |
| 321 | /* |