Custom translation objects

Related products: Software Factory

Would be nice to have custom translation objects to be used in the low-code part via e a standardized function. 

Hi Freddy,

It is already possible to add your own translation objects in the Software Factory. Could you elaborate on this idea a bit more? How would you like to use it, how would it be visible and any more details that could help the possible implementation?

For what is already possible, you can make use of Tags inside your Control procedure(s) to use the added Translation objects to generate code. Within a SQL-typed control procedure, you can for instance replace a tag [OWN_TRANSL_OBJECT] in your template by the Translation object you've added in the Software Factory.

Example:

Template
Generated code

 


Updated idea statusNewNeeds feedback

Updated idea statusNewNeeds feedback

 

Hi mark. 

Sometimes you want to have a generated text or content. In this case I would like to have a translation object (like messages) to have 'Em função há {1} ano(s), {2} mes(es), e {3} dia(s).' ..  so it can be translated via the SF like al the other GUI elements. 

concat_ws(' ','Em função há '
,floor(DATEDIFF(DAY,os.inicio_atividade_data,getdate())/365.0),'ano(s),'
,floor(DATEDIFF(DAY,os.inicio_atividade_data,getdate())%365/31.0),'mes(es), e'
,floor(DATEDIFF(DAY,os.inicio_atividade_data,getdate())%365%31),'dia(s).')

And then a procedure or so to (like with error messages)  give the translation the variables. 

Now this can, by my knowledge, only be translated in the code template. 


That is correct, you can create Messages with {0}, {1} parameters which you can then gives values via the tsf_send_message procedure. Additionally, it is also possible to include the column/parameter name to show its value - docs:

Here, the column/parameter movie_title will be replaced by its value

With the above example you could add three expression columns (example: year_column, month_column, day_column) using the calculation to get their value, then update your message translation to: 'Em função há {year_column} ano(s), {month_column} mes(es), e {day_column} dia(s).'

Would that suffice?


That is correct, you can create Messages with {0}, {1} parameters which you can then gives values via the tsf_send_message procedure. Additionally, it is also possible to include the column/parameter name to show its value - docs:

Here, the column/parameter movie_title will be replaced by its value

With the above example you could add three expression columns (example: year_column, month_column, day_column) using the calculation to get their value, then update your message translation to: 'Em função há {year_column} ano(s), {month_column} mes(es), e {day_column} dia(s).'

Would that suffice?

How would I apply this concept in a view to create dynamically translated column content? Don’t want a message or popup, want a generated textfield in the language of the user.


This would most likely be a function that returns a translation for a given translation object. You can use Translations in your Software Factory for that. You can for instance create new Translation objects with Object type "Message” and use a specific prefix that can help easily identify the user created Translation objects from any SF created translation objects.

Then, create a new subroutine with parameters and SQL-typed control procedure of code group Functions. You can make a table inside the functions that holds all translation objects and all it's translations by utilizing Parameters and SQL code to fill up the table upon generating.

Psuedo-code:

declare @transl table (
transl_object_id varchar(100),
appl_lang_id varchar(100),
transl nvarchar(2000)
)
insert into @transl
values
('[TRANSL_OBJECT]', '[lang]', N'[transl]'),
('-', '-', '-') -- For syntax pusposes

return (select transl
from @transl
where transl_object_id = @transl_object_id
and appl_lang_id = @appl_lang_id)

In the Control procedure code, you'll need to replace the prog object item parmtrs for TRANSL_OBJECT, LANG and TRANSL by the desired values. You may use the Staged strategy: https://docs.thinkwisesoftware.com/docs/sf/functionality#managing-code-generation-with-staging-tables


This would most likely be a function that returns a translation for a given translation object. You can use Translations in your Software Factory for that. You can for instance create new Translation objects with Object type "Message” and use a specific prefix that can help easily identify the user created Translation objects from any SF created translation objects.

Then, create a new subroutine with parameters and SQL-typed control procedure of code group Functions. You can make a table inside the functions that holds all translation objects and all it's translations by utilizing Parameters and SQL code to fill up the table upon generating.

Psuedo-code:

declare @transl table (
transl_object_id varchar(100),
appl_lang_id varchar(100),
transl nvarchar(2000)
)
insert into @transl
values
('[TRANSL_OBJECT]', '[lang]', N'[transl]'),
('-', '-', '-') -- For syntax pusposes

return (select transl
from @transl
where transl_object_id = @transl_object_id
and appl_lang_id = @appl_lang_id)

In the Control procedure code, you'll need to replace the prog object item parmtrs for TRANSL_OBJECT, LANG and TRANSL by the desired values. You may use the Staged strategy: https://docs.thinkwisesoftware.com/docs/sf/functionality#managing-code-generation-with-staging-tables

Thanks. Still would be a good idea to have a formalized function in the SF for this it is a general concept and it would be good that Thinkwise would extend the translation concept into its low-code concept as well and not leave it to its individual clients. 


The challenge is that the Model is not available in the End product, so using a function will not be able to obtain any model objects, hence that a Function is needed for it. We could of course create a new Code group for this for example but it will be hardcode on the database nevertheless.

Another way would be that Indicium would create a session variable for each translation object, but that would be very negative for performance. Or actually creating a translation table in your End product which holds the translations, that might be the most fitting option. We could make a Thinkstore entry for this sometime.


The challenge is that the Model is not available in the End product, so using a function will not be able to obtain any model objects, hence that a Function is needed for it. We could of course create a new Code group for this for example but it will be hardcode on the database nevertheless.

Another way would be that Indicium would create a session variable for each translation object, but that would be very negative for performance. Or actually creating a translation table in your End product which holds the translations, that might be the most fitting option. We could make a Thinkstore entry for this sometime.

But translations are available in the model and thus end product. The requested idea is to have a formalized way to use translatable objects in views and expression fields. The last thing you normally want is hard coded translations. Same goes for elements of a combo. If you want to parse them into a expression (field or view) you have to or hard code the translations or create manual procedures to get translations into your end product database. 
 

A good idea would be to have all translations available through indicium and maybe a system flow to have translations synced to end product DB so you can easily use translations in the code parts. 


Updated idea statusNeeds feedbackUnder review

Updated idea statusUnder reviewOpen

Unfortunately, this idea has not received enough votes. Because we want to keep the focus on ideas that are in high demand in our Community, we are closing this idea.


OpenClosed