全球支持Global support

PowerApps 是全球性的产品。PowerApps is a global product. 可以在许多不同的区域中构建和使用许多不同语言的应用。You can build and use apps in many different languages and regions.

生成和运行应用时,PowerApps 显示的文本已翻译成各种不同的语言。Both while building and running apps, the text displayed by PowerApps has been translated into a variety of languages. 你将看到以本地语言显示的菜单项、对话框、功能区选项卡和其他文本。You will see menu items, dialog boxes, ribbon tabs, and other text in your native language. 键入和显示日期与数字时也会针对你的特定语言和区域而调整。Typing in and displaying dates and numbers is also adapted for your particular language and region. 例如,全球的一些区域使用“.”作为小数分隔符,而其他区域使用“,”。For example, some regions of the world use "." as a decimal separator while others use ",".

你创建的应用也可以全球闻名。The apps you create can be globally aware as well. 使用 LanguageTextValueDateValue 及其他函数可改动作为不同语言的输入而显示和使用的内容。Use the Language, Text, Value, DateValue and other functions to adapt what is displayed and used as input in different languages.

语言设置Language settings

使用本机工作室或本机播放器时,所使用的语言由主机操作系统提供。When using the native studio or a native player, the language used is provided by the host operating system. 对于 Windows,可以在“所有设置”下的“时间和语言”设置中控制此项。For Windows, this can be controlled under "All Settings" and then "Time & language" settings. Windows 还允许你指定要用作小数分隔符的字符以覆盖语言设置。Windows also allows you to specify the characters to use for the decimal separator, overriding the language setting.

使用 Web 体验时,所使用的语言由浏览器提供。When using the web experiences, the language used is provided by the browser. 大多数浏览器默认为使用主机操作系统的设置,某些浏览器还提供了手动设置语言的方式。Most browser default to the host operating system's setting with some also providing a way to set the language manually.

创作环境Authoring environment

创作环境会适应作者的语言设置。The authoring environment adapts to the language setting of the author. 应用本身以与语言无关的方式存储,以便使用不同语言的作者可以编辑同一应用。The app itself is stored in a language agnostic manner, so that authors using different languages can edit the same app.

公式中的名称Names in formulas

公式中的大多数元素始终用英文表示:Most elements in formula are always in English:

  • 函数名称:IfNavigateCollect...Function names: If, Navigate, Collect, ...
  • 控件属性名称:Screen.FillButton.OnSelectTextbox.Font...Control property names: Screen.Fill, Button.OnSelect, Textbox.Font, ...
  • 枚举名称:Color.AquaDataSourceInfo.MaxValueFontWeight.Bold...Enumeration names: Color.Aqua, DataSourceInfo.MaxValue, FontWeight.Bold...
  • 信号记录:Compass.HeadingLocation.纬度App.ActiveScreen...Signal records: Compass.Heading, Location. Latitude, App.ActiveScreen, ...
  • 运算符:ParentinexactIn...Operators: Parent, in, exactIn, ...

当创作体验已本地化时,控件及其他对象名称将以作者的本地语言显示。As the authoring experience is localized, control and other object names will appear in the native language of the author. 西班牙语版的某些控件名称显示为:In Spanish, some of the control names appear as:

将其中一个控件插入到应用时,其名称将默认为英语。When you insert one of these into your app, their name will default to English. 这样做是为了让控件属性名称与公式的其余部分保持一致。This is done for consistency with the control property names and the rest of the formula. 例如,上面列出的 Casilla 将插入为 Checkbox1For example, Casilla listed above is inserted as Checkbox1.

插入控件后,可以将其名称更改为你所需的任何内容。After a control is inserted, you can change the name to whatever you like. 选中控件时,“内容”功能区的最左侧将显示控件的名称。While selected, the far left hand side of the "Content" ribbon displays the name of the control. 选择此名称会下拉出文本框,你可以在其中编辑名称:Selecting this name drops down a text box where you can edit the name:

如果你愿意,在此处可以将该控件重命名为 Casilla1If you like, here you can rename the control to Casilla1. 在本例中,浏览器之所以显示红色波浪线是因为该名称不是西班牙语单词且不相关。The red squiggly, in this case displayed by a browser, is because the name is not a Spanish word and is of no concern.

可以对以下各项使用你所需的任何名称:You can use whatever names you like for:

  • 控件名称Control names
  • 集合名称Collection names
  • 上下文变量名称Context variable names

公式分隔符和链接运算符Formula separators and chaining operator

某些分隔符和运算符将基于作者的语言小数分隔符进行变换:Some separators and operators will shift based on the decimal separator of the author's language:

作者的语言小数分隔符Author's language decimal separator PowerApps 小数分隔符PowerApps decimal separator PowerApps 列表分隔符PowerApps list separator PowerApps 链接运算符PowerApps chaining operator
.. (句点)(period) .. (句点)(period) ,(逗号), (comma) ;(分号); (semi-colon)
,(逗号), (comma) ,(逗号), (comma) ;(分号); (semi-colon) ;;(双分号);; (double semi-colon)

PowerApps 列表分隔符的更改将与 Excel 列表分隔符的更改保持一致。The change in the PowerApps list separator is consistent with that happens to the Excel list separator. 它影响以下项:It impacts:

  • 函数调用中的参数。Arguments in function calls.
  • 记录中的字段。Fields in a record.
  • 值表中的记录。Records in a Value table.

例如,请考虑用“美国英语”表示的以下公式:For example, consider the following formula in "en-US":

  • If( Slider1.Value > 12.59, UpdateContext( { Validation: true, MovingOn: 1 } ); Navigate( "NextScreen", "" ), UpdateContext( { Validation: false } ) )If( Slider1.Value > 12.59, UpdateContext( { Validation: true, MovingOn: 1 } ); Navigate( "NextScreen", "" ), UpdateContext( { Validation: false } ) )

在“,”用作小数分隔符的语言中,这将在创作体验中显示为:In a language where "," is used for the decimal separator, this will appear in the authoring experience as:

  • If( Slider1.Value > 12,59; UpdateContext( { Validation: true; MovingOn: 1 } );; Navigate( "NextScreen", "" ); UpdateContext( { Validation: false } ) )If( Slider1.Value > 12,59; UpdateContext( { Validation: true; MovingOn: 1 } );; Navigate( "NextScreen", "" ); UpdateContext( { Validation: false } ) )

请注意,属性选择运算符 .Note that the property selection operator . (在 Slider1.Value 中)始终相同,而与小数分隔符无关。in Slider1.Value is always the same, no matter what the decimal separator is.

在内部,公式不会更改,所有的更改都与作者如何显示和编辑它相关。Internally the formula does not change, all that changes is how it is displayed and edited by the author. 使用两种不同语言的两个不同的作者可以查看和编辑同一公式,每个作者都会看到相应于其语言的分隔符和运算符。Two different authors using two different languages can view and edit the same formula, with each seeing the appropriate separators and operators for their language.

创建全球性的应用Creating a global app

你创建的应用可以适应不同语言,从而为全球的用户提供卓越的用户体验。The app you create can adapt to different languages, providing a great user experience for your users around the world.

Language 函数Language function

Language 函数可返回当前用户的语言标记。The Language function returns the language tag of the current user. 例如,此函数对英国用户返回“en-GB”,对德国用户返回“de-DE”。For example, this function returns "en-GB" for users in Great Britain and "de-DE" for users in Germany.

此外,还可以使用 Language 为用户显示已翻译的文本。Among other things, you can use Language to display translated text for your users. 你的应用可以包含应用中已翻译值的表:Your app can include a table of translated values in your app:

然后可以使用如下所示的公式从该表中提取已翻译的字符串:And then use a formula such as the following to pull translated strings from the table:

  • LookUp( Table1, TextID = "Hello" && (LanguageTag = Left( Language(), 2 ) || IsBlank( LanguageTag ))).LocalizedTextLookUp( Table1, TextID = "Hello" && (LanguageTag = Left( Language(), 2 ) || IsBlank( LanguageTag ))).LocalizedText

请注意,将字符串翻译成其他语言后比你的语言长得多。Be aware that translated strings in other languages could be significantly longer than they are in your language. 在很多情况下,要将在用户界面中显示字符串的标签和其他元素设计得稍宽一些,以便容纳较长的语言版本。In many cases, the labels and other elements that display the strings in your user interface will need to be wider to accommodate.

有关详细信息,请参阅 Language 函数的文档。For more information, see the documentation for the Language function.

设置数字、日期和时间的格式Formatting numbers, dates, and times

数字、日期和时间以世界各地的不同格式编写。Numbers, dates, and times are written in different formats in different parts of the world. 逗号、小数的含义以及月、日和年的顺序因位置而异。The meaning of commas, decimals, and the order of month, date, and year vary from location to location.

Text 函数使用用户的语言设置来设置数字和日期的格式。The Text function formats numbers and dates using the language setting of the user.

Text 需要通过格式字符串来知道你希望如何设置数字或日期的格式。Text requires a format string to know how you want to format the number or date. 此格式字符串可以采用以下两种形式之一:This format string can take one of two forms:

  • 全球知晓的枚举。A global aware enumeration. 例如,Text(Now(), DateTimeFormat.LongDate)For example, Text( Now(), DateTimeFormat.LongDate ). 此公式将使用语言相应的格式设置当前日期的格式。This formula will format the current date in a language appropriate format. 这是用于指定格式字符串的首选方法。This is the preferred way to specify the format string.
  • 自定义格式字符串。A custom format string. 例如,Text( Now(), "[$-en-US]dddd, mmmm dd, yyyy" ) 在以语言“en-US”使用时将显示与枚举相同的文本。For example, Text( Now(), "[$-en-US]dddd, mmmm dd, yyyy" ) displays the same text as the enumeration when used in the language "en-US". 自定义格式字符串的优点是,你可以确切地指定所需的格式。The advantage of the custom format string is that you can specify exactly what you want.

自定义格式字符串前面的 "[$-en-US]" 告知 Text 用哪种语言解释该自定义格式字符串。The "[$-en-US]" on the front of the custom format string tells Text in which language to interpret the custom format string. 这会插入并默认为你的创作语言。This is inserted for you and defaults to your authoring language. 通常不需要更改它。Normally you will not need to change this. 在使用不同语言的作者编辑同一应用时,它将十分有用。It is useful when authors from different languages are editing the same app.

Text 的第三个参数指定要将哪种语言用于函数的结果。The third argument to Text specifies which language to use for the result of the function. 默认值为当前用户的语言设置。The default is the language setting of the current user.

有关详细信息,请参阅 Text 函数的文档。For more information, see the documentation for the Text function.

读取数字、日期和时间Reading numbers, dates, and times

有四个函数可用于读取用户提供的数字、日期和时间:There are four functions for reading numbers, dates, and times provided by the user:

  • Value:将文本字符串中的数字转换为数值。Value: Converts a number in a text string to a number value.
  • DateValue:将文本字符串中的日期值转换为日期/时间值。DateValue: Converts a date value in a text string to a date/time value. 文本字符串中指定的任何时间都将被忽略。Any time specified in the text string is ignored.
  • TimeValue:将文本字符串中的时间值转换为日期/时间值。TimeValue: Converts a time value in a text string to a date/time value. 文本字符串中指定的任何日期都将被忽略。Any date specified in the text string is ignored.
  • DateTimeValue:将文本字符串中的日期和时间值转换为日期/时间值。DateTimeValue: Converts a date and time value in a text string to a date/time value.

如果使用了 Excel,所有这些函数均已组合到单个 Value 函数中。If you have used Excel, all of these functions are combined in the single Value function. 此处将它们细分是因为 PowerApps 中的日期/时间值和数字有单独的类型。They are broken out here since PowerApps has separate types for date/time values and numbers.

所有这些函数都具有相同的参数:All of these functions have the same arguments:

  • String,必需:用户提供的字符串。String, required: A string from the user. 例如,键入到“文本输入”控件中并使用 Text 属性从该控件中读取的字符串。For example a string types into a Text input control and read from the control with the Text property.
  • Language,可选:用于解释 String 的语言。Language, optional: The language in which to interpret the String. 默认情况下为用户的语言设置。By default, the language setting of the user.

例如:For example:

  • 位于将“en-US”作为用户语言的地点时,Value( "12,345.678", "en-US" )Value( "12,345.678" ) 返回数值 12345.678,以用于计算。Value( "12,345.678", "en-US" ) or Value( "12,345.678" ) when located where "en-US" is the user's language returns the number 12345.678, ready for calculations.
  • 位于将“es-ES”作为用户语言的地点时,DateValue( "1/2/01", "es-ES" )DateValue( "1/2/01" ) 返回日期/时间值 February 1, 2001 at midnightDateValue( "1/2/01", "es-ES" ) or DateValue( "1/2/01" ) when located where "es-ES" is the user's language returns the date/time value February 1, 2001 at midnight.
  • 位于将“fr-FR”作为用户语言的地点时,TimeValue( "11:43:02", "fr-FR" )DateValue( "11:43:02" ) 返回日期/时间值 January 1, 1970 at 11:43:02TimeValue( "11:43:02", "fr-FR" ) or DateValue( "11:43:02" ) when located where "fr-FR" is the user's language returns the date/time value January 1, 1970 at 11:43:02.
  • 位于将“de-DE”作为用户语言的地点时,TimeDateValue( "11:43:02 1/2/01", "de-DE" )DateValue( "11:43:02" ) 返回日期/时间值 February 1, 2001 at 11:43:02TimeDateValue( "11:43:02 1/2/01", "de-DE" ) or DateValue( "11:43:02" ) when located where "de-DE" is the user's language returns the date/time value February 1, 2001 at 11:43:02.

有关详细信息,请参阅有关 ValueDateValue、TimeValue 和 DateTimeValue 函数及使用日期和时间的文档。For more information, see the documentation for the Value and DateValue, TimeValue, and DateTimeValue functions and working with dates and times.

日历和时钟信息Calendar and Clock information

CalendarClock 函数提供适用于用户当前语言的日历和时钟信息。The Calendar and Clock functions provide calendar and clock information for the user's current language.

此外,使用这些函数可为“下拉列表”控件提供选项列表。Among other things, use these functions to provide a Dropdown control with a list of choices.

有关详细信息,请参阅 CalendarClock 函数的文档。For more information, see the documentation for the Calendar and Clock functions.