You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to support more localized strings for any user-generated content, we need to provide a new model that will make that easy and painless for them. This should allow language blocks to be stored for an language (or idiom as the user guide calls it) for any table/type of info. The simplest way to handle this is probably through a single table with the following fields:
object_id
table
field
language
text
So we would be creating a new model:
extends from CIDbModel, called LocalizedModel
new class var: $localized_fields which is an array of column names that will have localization.
new class_var: $default_language which will default to english but can be overridden by child classes to provide new default.
new method: with_lang() that sets the language for that call. Uses a $temp_language class var
new method: with_all_langs() that tells the system to retrieve all text strings for the returned object.
new after_find observer that examines the select statement in the class and adds the appropriate left joins to pull in the language strings. If only one language is returned it should simply include the language string in that object's field. If multiple languages are being returned, should make that field an array of key/value pairs where the key is the language and the value is the text string.
new before_update observer that will remove any localized fields that need to be saved out to the language database.
new after_update observer that will actually our update strings based on the current langauge.
The text was updated successfully, but these errors were encountered:
In order to support more localized strings for any user-generated content, we need to provide a new model that will make that easy and painless for them. This should allow language blocks to be stored for an language (or idiom as the user guide calls it) for any table/type of info. The simplest way to handle this is probably through a single table with the following fields:
So we would be creating a new model:
$localized_fields
which is an array of column names that will have localization.$default_language
which will default toenglish
but can be overridden by child classes to provide new default.with_lang()
that sets the language for that call. Uses a$temp_language
class varwith_all_langs()
that tells the system to retrieve all text strings for the returned object.field
. If multiple languages are being returned, should make that field an array of key/value pairs where the key is the language and the value is the text string.The text was updated successfully, but these errors were encountered: