Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
jvx:client:model:databook:recordtranslation [2018/02/01 09:58] admin |
jvx:client:model:databook:recordtranslation [2020/07/08 17:40] (current) cduncan articles |
||
---|---|---|---|
Line 1: | Line 1: | ||
~~NOTRANS~~ | ~~NOTRANS~~ | ||
- | ~~Title: Record translation~~ | + | ~~Title: Record Translation~~ |
- | Sometimes it's important to translate records of a table/data book. If you have such a requirement, you can use different solutions: | + | Sometimes it's important to translate records of a table/databook. If you have such a requirement, you can use different solutions: |
* Use a view and translate column values via database | * Use a view and translate column values via database | ||
* Translate values on the client (without database) | * Translate values on the client (without database) | ||
- | If you choose the first option, everything will be fine because it'll be possible to use filtering and searching via database. With second option, only client-side filtering and searching will work. //Why?// | + | If you choose the first option, everything will be fine because it'll be possible to use filtering and searching via database. With the second option, only client-side filtering and searching will work. //Why?// |
- | If you translate e.g. an English content to German on client side, the value in the database is still English. If the user tries to search a German value, the database won't find it because all values are in English. | + | If you translate, for example, English content to German on the client side, the value in the database is still English. If the user tries to search a German value, the database won't find it because all values are in English. |
- | The second option is easier to use and the first one needs some database/view logic. The second option will load/fetch all records because of sorting and filtering. If you have only few records, or searching and filtering is not important, the second option will be perfect. | + | The second option is easier to use, and the first one needs some database/view logic. The second option will load/fetch all records because of sorting and filtering. If you have only few records, or searching and filtering is not important, the second option will be perfect. |
- | == How client translation works? == | + | == How Client Translation Works == |
- | StringDataType has following methods: | + | StringDataType has the following methods: |
<file java> | <file java> | ||
Line 32: | Line 32: | ||
== What is an ITranslator? == | == What is an ITranslator? == | ||
- | We have default implementations for the interface. Simply use a TranslationMap, an UIComponent or an instance of IControl. Usually it's not needed to implement your own translator. | + | We have default implementations for the interface. Simply use a TranslationMap, an UIComponent, or an instance of IControl. Usually it's not needed to implement your own translator. |
== Example == | == Example == | ||
- | The [[http://sourceforge.net/p/jvx/code/HEAD/tree/trunk/java/library/src/com/sibvisions/rad/genui/celleditor/UIEnumCellEditor.java|UIEnumCellEditor]] automatically translates the display values. Simply check the source code or use following snippet: | + | The [[http://sourceforge.net/p/jvx/code/HEAD/tree/trunk/java/library/src/com/sibvisions/rad/genui/celleditor/UIEnumCellEditor.java|UIEnumCellEditor]] automatically translates the display values. Simply check the source code or use the following snippet: |
<file java> | <file java> |