属性のローカライズ

属性のデータがロケールごとに異なる場合、属性をローカライズします。

属性をローカライズする手順は次のとおりです。
  1. デフォルト・ロケールの属性を定義します。
  2. 属性をローカライズする各ロケールについて、ロケール固有の属性バージョンをそれぞれ定義します。

    言語が違っても、同じ文字列が同じ概念を表す場合もあります。したがって、ロケール固有の属性のキーを定義する際は、各キーが一意になるようなネーミング規則を使用してください。たとえば、デフォルト・ロケールの属性キーにロケール文字列を付加します。

  3. デフォルト・ロケールの属性にsystem-eid_localizedAttributeメタデータ・プロパティを追加します。プロパティの値は、ロケールごとに固有の属性を指定するJSON文字列です。たとえば、{"fr":"attributeKey_fr","es":"attributeKey_es","it":"attributeKey _it","de":"attributeKey_de"}のようにします。

属性のローカライズ

この例では、次のロケールをサポートしています。
  • ドイツ語(de_DE)
  • フランス語(fr_FR)
  • スペイン語(es_ES)
デフォルト・ロケール(en-us)に属性Colorを定義しています。この属性の値はロケールごとに異なる短い文字列であるため、属性をローカライズします。Color属性の定義に加えて、次の属性も定義します。
表1 ローカライズ後の属性の例
属性キー 表示名
Color_de_DE Farbe
Color_fr_FR Couleur
Color_es_ES Color

その後、デフォルト・ロケールのColor属性にsystem-eid_localizedAttributeメタデータ・プロパティを追加します。この属性の値は、{"fr_FR":"Color_fr_FR","es_ES":"Color_es_ES ","de_DE":"Color_de_DE"}です。

下のビュー定義の例では、Color属性とDescription属性がローカライズされています。

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ns:putEntities xmlns:ns="http://www.endeca.com/endeca-server/sconfig/2/0">
      <ns:semanticEntity key="Products" displayName="Products" isActive="false"><ns:definition>/*Calculate Total Sales respecting Navigation*/DEFINE GlobalSales2 as select sum(FactSales_SalesAmount) AS TotalSales Group; DEFINE Products AS SELECT ProductSubcategoryName AS ProductSubcategoryName, ProductCategoryName AS ProductCategoryName, coalesce(ProductName, 'N/A') as ProductName, Description AS Description, Color as Color, arb(SurveyResponse) as "SurveyResponse",avg(FactSales_SalesAmount) AS AvgSales, sum(FactSales_SalesAmount) AS SalesSum, 
avg(FactSales_ProductStandardCost) AS AvgStandardCost, avg(ListPrice) AS AvgListPrice, avg(FactSales_UnitPrice) AS AvgUnitPrice, Avg(FactSales_OrderQuantity) as AvgQuantity, Sum(FactSales_SalesAmount-(FactSales_OrderQuantity*FactSales_ProductStandardCost)) as MonthlyProfit, 
Avg((FactSales_SalesAmount-(FactSales_OrderQuantity*FactSales_ProductStandardCost))/FactSales_OrderQuantity) as AvgMargin, sum(FactSales_SalesAmount)/GlobalSales2[].TotalSales as SalesShare, DimDate_FiscalYear*100+DimDate_MonthNumberOfYear as "Year-Month", 
DimDate_FiscalYear as DimDate_FiscalYear GROUP BY ProductName, "Year-Month"</ns:definition>
      <ns:description>This view is grouped to a year/month and product name.</ns:description>
	    <ns:attributes>
				<ns:semanticAttribute name="Color_de_DE" displayName="Farbe" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		</ns:semanticAttribute>		
		<ns:semanticAttribute name="Color_fr_FR" displayName="Couleur" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		</ns:semanticAttribute>		
		<ns:semanticAttribute name="Color_es_ES" displayName="Color" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="Color" displayName="Color" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		  <ns:property key="localizedAttributeMetadata">{"de_DE":"Color_de_DE","fr_FR":"Color_fr_FR", "es_ES":"Color_es_ES"}</ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="Description_de_DE" displayName="Beschreibung" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="Description_fr_FR" displayName="Description" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="Description_es_ES" displayName="Descripción" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="Description" displayName="Description" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		  <ns:property key="localizedAttributeMetadata ">{"de_DE":"Description_de_DE", "fr_FR":"Description_fr_FR", "es_ES":"Description_es_ES"}</ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="ProductCategoryName" displayName="Product Category Name" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		  <ns:property key="localizedDn">{"de_DE":"Produktbezeichnung", "fr_FR":"Nom de catégorie", "es_ES":"Categorías des Productos"}</ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="ProductName" displayName="Product Name" datatype="mdex:string" isDimension="true" isKeyColumn="true">
		  <ns:property key="availableAggregations">COUNT,COUNTDISTINCT</ns:property>
		  <ns:property key="defaultAggregation"></ns:property>
		  <ns:property key="localizedDn">{"de_DE":"Produktname", "fr_FR":"Nom de produit", "es_ES":"Nombre del producto"}</ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="SalesShare" displayName="Sales Share" datatype="mdex:double" isDimension="false" isKeyColumn="false">
		  <ns:property key="availableAggregations">SUM,AVG,MEDIAN,MIN,MAX,VARIANCE,STDDEV</ns:property>
		  <ns:property key="defaultAggregation">SUM</ns:property>
		  <ns:property key="formatSettings">{"type":"PERCENTAGE","@class":"com.endeca.portal.format.NumberFormatter"}</ns:property>
		  <ns:property key="localizedDn">{"de_DE":"Umsatzanteil", "fr_FR":"Division de ventes", "es_ES":"División de Ventas"}</ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="SalesSum" displayName="Sales Sum" datatype="mdex:double" isDimension="false" isKeyColumn="false">
		  <ns:property key="availableAggregations">SUM,AVG,MEDIAN,MIN,MAX,VARIANCE,STDDEV</ns:property>
		  <ns:property key="defaultAggregation">SUM</ns:property>
		  <ns:property key="localizedDn">{"de_DE":"Umsatz", "fr_FR":"somme de ventes", "es_ES":"Ventas totales"}</ns:property>
		  <ns:property key="formatSettings">{"type":"CURRENCY","@class":"com.endeca.portal.format.NumberFormatter","currencySymbol":"$"}</ns:property>
		</ns:semanticAttribute>
		<ns:semanticAttribute name="SurveyResponse" displayName="Survey Response" datatype="mdex:string" isDimension="true" isKeyColumn="false">
		  <ns:property key="availableAggregations">COUNT,ARB</ns:property>
		  <ns:property key="defaultAggregation">ARB</ns:property>
		  <ns:property key="localizedDn">{"de_DE":"Umfrageantwort", "fr_FR":"Réponse à l'enquête", "es_ES":"Respuesta a la encuesta"}</ns:property>
		</ns:semanticAttribute>
      </ns:attributes>
	  <ns:metrics/>
	  <ns:groups>
	    <group displayName="Products" key="Products">
		  <semanticAttributeKey name="ProductName"/>
		  <semanticAttributeKey name="ProductCategoryName"/>
		  <semanticAttributeKey name="Color"/>
		  <semanticAttributeKey name="Description"/>
		  <property key="includeInNavigation">true</property>
          <property key="includeInRecord">true</property>
          <property key="localizedDn">{"de_DE":"Produkte", "fr_FR":"Produits", "es_ES":"Productos"}</property>
		</group>
	  </ns:groups>
	</ns:semanticEntity>
</ns:putEntities>
</soap:Body>
</soap:Envelope>