简体   繁体   English

PowerBI - 视觉 API - 更改视觉属性 | 用法:翻译

[英]PowerBI - Visual API - changing Visual properties | usage: translations

Context: we're having our powerbi dashboards embedded either as a whole report or only standalone visuals.背景:我们将 powerbi 仪表板作为整个报告或仅作为独立的视觉对象嵌入。

We want to translate the content of our reports in several languages.我们希望将我们的报告内容翻译成多种语言。 some of it can be done via metadata translations ( DAx Editor -> cultures).其中一些可以通过元数据翻译(DAx 编辑器 -> 文化)来完成。

What we want to achieve is to have the visuals titles etc translated.我们想要实现的是翻译视觉标题等。 we are looking for a way which is easy to maintain.我们正在寻找一种易于维护的方式。

According to MS this could be achieved using the Visuals API but the documentation is new and we cannot interpret if we can use it for this.根据 MS 的说法,这可以使用 Visuals API 来实现,但文档是新的,我们无法解释是否可以使用它。

https://docs.microsoft.com/en-us/power-bi/developer/visuals/visual-api https://docs.microsoft.com/en-us/power-bi/developer/visuals/visual-api

Would there be someone who did this before and give some directions?会有人这样做过并给出一些指示吗?

Visual API is used to create custom visuals for Power BI. Visual API 用于为 Power BI 创建自定义视觉对象。 Currently, Power BI translates report content such as automatically generated titles, filters, and tooltips using locale settings.目前,Power BI 使用区域设置翻译报表内容,例如自动生成的标题、筛选器和工具提示。 but it doesn't translate your data automatically.但它不会自动翻译您的数据。

You can update your embed configuration like this:您可以像这样更新您的嵌入配置:

let embedConfig = {
    ...
    settings: {
        localeSettings: {
            language: "en",
            formatLocale: "es"
        }
    }
};

(Note: After the report has been loaded, the locale settings cannot be changed. To change the report locale settings, reset the iframe by calling powerbi.reset(element), and then embed the report again) (注意:报告加载后,区域设置无法更改。要更改报告区域设置,请通过调用 powerbi.reset(element) 重置 iframe,然后再次嵌入报告)

The alternative approach could be to create multiple reports/visuals for each language and embed them separately.另一种方法可以是为每种语言创建多个报告/视觉效果并分别嵌入它们。

For Instance, if I need to a visual in English and Spanish language.例如,如果我需要英语和西班牙语的视觉效果。 I'll make two visuals, one in Spanish and another in English, as well as a dropdown/input field.我将制作两个视觉效果,一个是西班牙语,另一个是英语,还有一个下拉/输入字段。 I'll update the configuration file and re-render the component based on the user's selection/input.我将根据用户的选择/输入更新配置文件并重新渲染组件。

References:参考:

Configure embedded Power BI report settings in a Power BI embedded analytics application | 在 Power BI 嵌入式分析应用程序中配置嵌入式 Power BI 报表设置 | Microsoft Docs 微软文档

Supported languages and countries/regions for Power BI - Power BI | Power BI 支持的语言和国家/地区 - Power BI | Microsoft Docs 微软文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM