1. Osclass Forum
  2. Themes
  3. The translation of new fields

The translation of new fields

Started by kris koyk, February 27, 2020, 9:58 pm

kris koyk

The translation of new fields

on :February 27, 2020, 9:58 pm #204

Add new fields (ie. Phone) Words exist in the archive core po en archive theme po but are not translated


calinbehtuk

Re: The translation of new fields

on :February 28, 2020, 7:14 am #205

Do you mean custom fields name?


If yes, you have to make some changes in the file Field.form.class.php from oc-includes/osclass/frm/


You have the function meta where you have to change each line that displays the name of the field, make sure that you check all lines because the for item page is one line and for search is another line and you have multiple types of fields.


this:

Code: [Select]
​  if($search) {
        echo '<h6>'.$field['s_name'].'</h6>';
     } else {
       echo '<label for="meta_'.$field['s_slug'].'">'.$field['s_name'].': </label>';
  }



like:

Code: [Select]
if($search) {
         echo '<h6>'.__($field['s_name']).'</h6>';
     } else {
           echo '<label for="meta_'.$field['s_slug'].'">'.__($field['s_name']).': </label>';
 }


Now you can use the translation file.core.po to add the name of the fields and translate. But make sure that you repeat this process for all types of fields.


  • << Last edit: February 28, 2020, 7:17 am by calinbehtuk >>
  • Quote

kris koyk

Re: The translation of new fields

on :February 28, 2020, 11:08 am #206

Thank you for your response. I did as you say, translated into management, translated into new ad introduction, not translated into ad serving.

calinbehtuk

Re: The translation of new fields

on :February 28, 2020, 4:53 pm #207

I don't understand you.


If is not working you did something wrong. The method is tested and is working fine.

kris koyk

Re: The translation of new fields

on :February 28, 2020, 9:05 pm #208

The change I made is this, (For phone only):



if($search) {
                        echo '<h6>'.__($field['s_name']).'</h6>';
                    } else {
                        echo '<label for="meta_'.__($field['s_slug']).'">'.__($field['s_name']).': </label>';
                    }
                    echo '<input id="meta_'.$field['s_slug'].'" type="text" name="meta['.$field['pk_i_id'].']" value="' . osc_esc_html((isset($field) && isset($field["s_value"])) ? $field["s_value"] : "") . '" />';
                }


See the result **, and **

  • << Last edit: February 29, 2020, 9:30 am by calinbehtuk >>
  • Quote

calinbehtuk

Re: The translation of new fields

on :February 29, 2020, 9:34 am #209

How i told you in the above message, all the changes you need to do is in that file, i presented the changes. This method is tested and is working fine.


Replace the field name from h6 element with the correct string

Add the translation of your field name in the core.po from oc-content/languages/core.po

Use poedit to save the translation



If this is not working, you are doing something wrong, follow all the steps carefully.


https://osclass.calinbehtuk.ro/blog/post/themes/translate-osclass-plugins-and-themes_p7

kris koyk

Re: The translation of new fields

on :March 1, 2020, 10:29 am #210

What is  "Replace the field name from h6 element with the correct string", can you give an example?

calinbehtuk

Re: The translation of new fields

on :March 1, 2020, 10:48 am #211

I already gave you in the last messages


Quote from: calinbehtuk on February 28, 2020, 7:14 am

Do you mean custom fields name?


If yes, you have to make some changes in the file Field.form.class.php from oc-includes/osclass/frm/


You have the function meta where you have to change each line that displays the name of the field, make sure that you check all lines because the for item page is one line and for search is another line and you have multiple types of fields.


this:

Code: [Select]
​  if($search) {
        echo '<h6>'.$field['s_name'].'</h6>';
     } else {
       echo '<label for="meta_'.$field['s_slug'].'">'.$field['s_name'].': </label>';
  }



like:

Code: [Select]
if($search) {
         echo '<h6>'.__($field['s_name']).'</h6>';
     } else {
           echo '<label for="meta_'.$field['s_slug'].'">'.__($field['s_name']).': </label>';
 }


Now you can use the translation file.core.po to add the name of the fields and translate. But make sure that you repeat this process for all types of fields.



kris koyk

Re: The translation of new fields

on :March 1, 2020, 10:54 am #212

I've done this and it didn't work

calinbehtuk

Re: The translation of new fields

on :March 1, 2020, 10:58 am #213

Sorry but i can help you with nothing more. This method is tested by me and is working fine. You are doing something wrong.

You have to replace all the h6 from the Field.form.class.php and update the translation in your language with the name of your field.

I am sure that you are missing some steps or you are not updating the correct core translation file from languages folder.



Subscribe
X

Subscribe!

Subscribe to get the latest listings, updates and special offers delivered directly in your inbox.