codyml commented on code in PR #21172:
URL: https://github.com/apache/superset/pull/21172#discussion_r954094039


##########
superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx:
##########
@@ -85,10 +86,10 @@ export const databaseField = ({
     value={db?.parameters?.database}
     validationMethods={{ onBlur: getValidation }}
     errorMessage={validationErrors?.database}
-    placeholder={t('e.g. world_population')}
+    placeholder={t(placeholder ?? 'e.g. world_population')}

Review Comment:
   I don't have a great sense of how translation strings work, but I wonder if 
this might break the build step of extracting translatable strings to have the 
argument of `t()` be dynamically set at render time.  If you or someone else 
knows for sure definitely correct me, but would it be safer to have this just 
be `placeholder ?? t('e.g. world_population')` and instead call `t()` for 
`placeholder` where the string literal is defined in 
`superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx`?



##########
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx:
##########
@@ -1607,6 +1615,7 @@ const DatabaseModal: 
FunctionComponent<DatabaseModalProps> = ({
                   }
                   getValidation={() => getValidation(db)}
                   validationErrors={validationErrors}
+                  getPlaceholder={field => getPlaceholder(field)}

Review Comment:
   Could this be done without defining a new inline function each render?
   
   ```suggestion
                     getPlaceholder={getPlaceholder}
   ```



-- 
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