alex-poor commented on code in PR #40679:
URL: https://github.com/apache/superset/pull/40679#discussion_r3875455691


##########
superset/charts/api.py:
##########
@@ -233,6 +233,7 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
         "dashboards.dashboard_title",
         "params",
         "slice_name",
+        "localized_name",

Review Comment:
   Fixed in 95fcbe7 — added `localized_name` to `ChartRestApi.get_list` and 
`ChartDataRestApi.get_list` (which inherits the chart `list_columns`) and 
`localized_title` to `DashboardRestApi.get_list`, alongside the GET response 
components from the previous round.



##########
examples/asset_metadata_translation/model.py:
##########
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Reference table for storing asset-metadata translations.
+
+NOT part of Superset core -- see this directory's README. A production version
+would live in an extension with its own Alembic migration; here we keep a 
single
+declarative model and a helper to create the table on demand.
+"""
+
+from __future__ import annotations
+
+from sqlalchemy import Column, Integer, String, Text, UniqueConstraint
+from sqlalchemy.orm import declarative_base
+
+Base = declarative_base()
+
+
+class AssetTranslation(Base):  # type: ignore[valid-type, misc]
+    """A single translation of one asset field into one language.
+
+    Keyed on the source text plus model/field context so identical strings in
+    different fields can be translated independently. ``default_text`` is the
+    canonical value stored on the asset (e.g. ``Slice.slice_name``).
+    """
+
+    __tablename__ = "asset_translations"
+
+    id = Column(Integer, primary_key=True)
+    model_name = Column(String(64), nullable=False)
+    field_name = Column(String(64), nullable=False)
+    default_text = Column(Text, nullable=False)

Review Comment:
   Fixed in 95fcbe7 — `default_text` is now `String(500)` rather than `Text`. 
500 covers both fields the example translates (`slice_name` is String(250), 
`dashboard_title` is String(500)) and keeps the four-column key inside InnoDB's 
index limit. `translated_text` is not part of the constraint, so it stays 
unbounded.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to