Osclass Support Forums

General osclass questions => General discussion => Topic started by: sellbuyrent me on June 14, 2022, 02:20:46 PM

Title: how add language switcher on the theme
Post by: sellbuyrent me on June 14, 2022, 02:20:46 PM
how add language switcher on the theme or widget code which should be?
Title: Re: how add language switcher on the theme
Post by: MB Themes on June 14, 2022, 03:37:31 PM
Just create link with following format:
Code: [Select]
<?php echo osc_base_url(); ?>language/{xy_AB}
Title: Re: how add language switcher on the theme
Post by: sellbuyrent me on June 16, 2022, 12:50:21 PM
which folder and file i should insert it plz
i try to insert this code  also:
  <div class="langs">
        <?php if ( osc_count_web_enabled_locales() > 1) { ?>
          <?php $current_locale = mb_get_current_user_locale(); ?>

          <?php osc_goto_first_locale(); ?>
          <?php while ( osc_has_web_enabled_locales() ) { ?>
            <a class="lnk lang <?php if (osc_locale_code() == $current_locale['pk_c_code']) { ?>active<?php } ?>" href="<?php echo osc_change_language_url(osc_locale_code()); ?>"><img src="<?php echo osc_current_web_theme_url();?>images/country_flags/large/<?php echo strtolower(substr(osc_locale_code(), 3)); ?>.png" alt="<?php _e('Country flag', 'beta');?>" /><span><?php echo osc_locale_name(); ?>&#x200E;</span></a>
          <?php } ?>
        <?php } ?>
      </div>
where to plz?
Title: Re: how add language switcher on the theme
Post by: MB Themes on June 16, 2022, 12:55:53 PM
@sellbuyrent
If you do not know file, how will you style it etc? Such question should not be asked. You place it where you need it, header.php or footer.php
Title: Re: how add language switcher on the theme
Post by: sellbuyrent me on June 16, 2022, 01:01:10 PM
@sellbuyrent
If you do not know file, how will you style it etc? Such question should not be asked. You place it where you need it, header.php or footer.php
i did insert in those files and its not working all design has disappeared
Title: Re: how add language switcher on the theme
Post by: mwindey on June 16, 2022, 01:24:55 PM
Always remember: https://www.youtube.com/watch?v=AqrxgEln_Dw


 :D ;) ;)
Title: Re: how add language switcher on the theme
Post by: MB Themes on June 16, 2022, 05:42:29 PM
@sellbuyrent
You might broke PHP.

@mwindey
That is old-school music style  ??? ::) :'(
Title: Re: how add language switcher on the theme
Post by: sellbuyrent me on June 16, 2022, 06:35:53 PM
no i found out how to fix wit ur supportative  old song . thnaks walla
secpnd question plz: i try to translate out the theme with Poedit
i do translate files theme.po from en_Us of the theme folder
then i saving as Theme.po and upload this in de_De folder (new langauage ) and its nothing translate when i switch the lanaguage
what is wrong plz any idea?
regards
Title: Re: how add language switcher on the theme
Post by: MB Themes on June 17, 2022, 02:57:33 PM
Osclass use .mo file as source of translation. Best practice is to keep both files.
Title: Re: how add language switcher on the theme
Post by: sellbuyrent me on June 18, 2022, 11:13:44 AM
enno ofcourse we do keep both files walaw and still not translated . for guys whom facing same problem - there is other forums review this problems so the problems is with updating theme and different number of line's code...need be checking up those file which is refers to lanaguages . regards
Title: Re: how add language switcher on the theme
Post by: sellbuyrent me on June 20, 2022, 02:01:34 PM
also as insctuction osclass said check with table t_locale and make sure language code (pk_c_code) ashould same even letter capital or not capital
Title: Re: how add language switcher on the theme
Post by: MB Themes on June 29, 2022, 08:12:22 PM
Code references in .PO files are informal only. Also PO without referencing in code will work
Title: Re: how add language switcher on the theme
Post by: MB Themes on June 29, 2022, 08:13:04 PM
also as insctuction osclass said check with table t_locale and make sure language code (pk_c_code) ashould same even letter capital or not capital

Yes, it must match and is case sensitive, xx_YY