Is there a way to override content method

Hello all. My idea is rather simple, I think. I have 2 pretty much similar tables content that is a standart modx table and translations wich is identical but has an other column called locale. What I want to do in my snipped is somethin lake this:

<?php
if($_GET['lang']=='en'
{
$sql = "select * from translations where local='en'";
}
else
{
$sql="select * from content";; //with current page_id etc...
}
?>
`
Sorry for bad syntax this was written pretty much on laps just to show an idea. I do understand the consiquence of it and thought may be I could just paste a content functionality into a snippet or is there a better way to achive it? Or where are those finctions exist in modx core?

what you are asking for, is basically, what migxMultilang or Lingua does. Fetching translated content. like resourcefields or TVs from Translation Tables. But I didn’t touch migxMultilang for years and Lingua isn’t maintained any more, as far as I know.
I’m using Babel for translating Resources, because its so much cleaner to have separate Resources for each language, IMO.

From your last question, I assume you want to replicate the functionality of Lingua for MODX3.

I tried to install the current version of Lingua on MODX3 and although it throws some errors during the installation, most of the functionality still seems to work.
So it’s probably easier to make some fixes to Lingua than to program something entirely new.

migksMultilang is not mainteined eather. I tryed to use babel but the main problem for me is that it sims you cannot add an other language without reinstalling the plugin. What is planned originally is to create seviral languages for content and use automatic translation for them like Google Microsoft translate etc. One part of it is already done I have a table with localization and can provide a values there with manager pannel.

May be you are right. But it is my first time ever touching Modx.

No, that is not the case.

To you have a schema for this table, or did you simply create the table in the database?

Yes. I managed to crreate it by example ofcorse but still. Lat me post it entirly here.

<?xml version="1.0" encoding="UTF-8"?>
<model package="localizator" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" phpdoc-package="localizator"
       version="1.1">

       <object class="localizatorLanguage" table="localizator_languages" extends="xPDOSimpleObject">
              <field key="name" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
              <field key="key" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
              <field key="cultureKey" dbtype="varchar" precision="100" phptype="string" null="true" default=""/>
              <field key="http_host" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
              <field key="description" dbtype="text" phptype="string" null="true" default=""/>
              <field key="active" dbtype="tinyint" precision="1" phptype="boolean" null="true" default="1"/>

              <index alias="key" name="key" primary="false" unique="false" type="BTREE">
                     <column key="key" length="" collation="A" null="false"/>
              </index>
              <index alias="cultureKey" name="cultureKey" primary="false" unique="false" type="BTREE">
                     <column key="cultureKey" length="" collation="A" null="true"/>
              </index>
       </object>

       <object class="localizatorContent" table="localizator_content" extends="xPDOSimpleObject">
              <field key="resource_id" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="true" default="0"/>
              <field key="key" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
              <field key="pagetitle" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
              <field key="longtitle" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
              <field key="menutitle" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
              <field key="seotitle" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
              <field key="keywords" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
              <field key="introtext" dbtype="text" phptype="string" null="true" default=""/>
              <field key="description" dbtype="text" phptype="string" null="true" default=""/>
              <field key="content" dbtype="mediumtext" phptype="string" null="true"  />
              <field key="active" dbtype="tinyint" precision="1" phptype="boolean" null="true" default="1"/>

              <index alias="resource_id" name="resource_id" primary="false" unique="false" type="BTREE">
                     <column key="resource_id" length="" collation="A" null="false"/>
              </index>
              <index alias="key" name="key" primary="false" unique="false" type="BTREE">
                     <column key="key" length="" collation="A" null="false"/>
              </index>

              <aggregate alias="Resource" class="modResource" local="resource_id" foreign="id" cardinality="one" owner="foreign" />
       </object>

       <object class="locTemplateVarResource" table="localizator_tmplvar_contentvalues" extends="xPDOSimpleObject">
              <field key="key" dbtype="varchar" precision="100" phptype="string" null="false" default="" index="index"/>
              <field key="tmplvarid" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />
              <field key="contentid" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />
              <field key="value" dbtype="mediumtext" phptype="string" null="false" />

              <index alias="key" name="key" primary="false" unique="false" type="BTREE">
                     <column key="key" length="" collation="A" null="false" />
              </index>
              <index alias="tmplvarid" name="tmplvarid" primary="false" unique="false" type="BTREE">
                     <column key="tmplvarid" length="" collation="A" null="false" />
              </index>
              <index alias="contentid" name="contentid" primary="false" unique="false" type="BTREE">
                     <column key="contentid" length="" collation="A" null="false" />
              </index>
              <index alias="tv_cnt" name="tv_cnt" primary="false" unique="true" type="BTREE">
                     <column key="key" length="" collation="A" null="false" />
                     <column key="tmplvarid" length="" collation="A" null="false" />
                     <column key="contentid" length="" collation="A" null="false" />
              </index>

              <aggregate alias="TemplateVar" class="modTemplateVar" local="tmplvarid" foreign="id" cardinality="one" owner="foreign" />
              <aggregate alias="Resource" class="modResource" local="contentid" foreign="id" cardinality="one" owner="foreign" />
       </object>

</model>

It’s seems to me that you are trying to replicate the functionality of the snippet “lingua.getvalue” in Lingua.
Maybe look at that code for inspiration.

In the snippet you can access the current resource with $modx->resource.
You can query data from your custom table with getObject() or getCollection().
Maybe you have to call addPackage() first, so that you can access your custom tables with xPDO.