use web_sys::Element;
pub fn read_custom_property(elem: &Element, name: &str) -> Option<String> {
let value = web_sys::window()?
.get_computed_style(elem)
.ok()??
.get_property_value(name)
.ok()?;
let value = value.trim();
(!value.is_empty()).then(|| value.to_owned())
}
pub fn read_intl_string(elem: &Element, slug: &str) -> Option<String> {
let raw = read_custom_property(elem, &format!("--psp-label--{slug}--content"))?;
let unquoted = raw
.strip_prefix('"')
.and_then(|x| x.strip_suffix('"'))
.or_else(|| raw.strip_prefix('\'').and_then(|x| x.strip_suffix('\'')))
.unwrap_or(&raw);
Some(unquoted.replace("\\\"", "\""))
}