HR
Asked
Hello, there is some option to place the URLs in Spanish or English depending on how it is configured.
Example:
Admin:
Spanish: https://midominio/admin/productos
English: https://mydomain/admin/products
Shop:
Spanish: https://midominio/tienda/productos
English: http://mydomain/shop/products
Otherwise how can I do to put them in Spanish.
Example:
https://midominio/admin/productos
https://midominio/tienda/productos
https://midominio/pagina/contactos
I would also like to know how to remove parts of the URLs "page", "shop", etc., according to the following examples:
https://mydomain/page/terms-conditions
Change for
https://mydomain/terms-conditions
https://mydomain/page/about
Change for
https://mydomain/about
https://mydomain/shop/products
Change for
https://mydomain/products
Thank you.
Example:
Admin:
Spanish: https://midominio/admin/productos
English: https://mydomain/admin/products
Shop:
Spanish: https://midominio/tienda/productos
English: http://mydomain/shop/products
Otherwise how can I do to put them in Spanish.
Example:
https://midominio/admin/productos
https://midominio/tienda/productos
https://midominio/pagina/contactos
I would also like to know how to remove parts of the URLs "page", "shop", etc., according to the following examples:
https://mydomain/page/terms-conditions
Change for
https://mydomain/terms-conditions
https://mydomain/page/about
Change for
https://mydomain/about
https://mydomain/shop/products
Change for
https://mydomain/products
Thank you.
- MSAnsweredHello,
There is no such option. You will need to modify the item code. The routes file is in `app/config/` folder. I won't suggest doing this unless you know what are you doing.
Thank you - HRAnsweredPerfect friend, thanks.
Look what I did to see if it is ok, in the file "app\config\routes.php", add the line in Spanish, looking like this:
$ route ['producto/(: any)'] = 'shop/shop/product/$1';
$ route ['product/(: any)'] = 'shop/shop/product/$1';
Now when entering the product it enters me in any of these two ways:
https://mydomain/producto/impresora
https://mydomain/product/impresora
and on the link path
site_url('producto/' . $product->slug)
site_url('product/' . $product->slug)
now well as I can do the "if" to detect the language and use the link.
Thank you. - MSAnsweredYes, that looks good. Thank you for sharing with others :)
- HRAnsweredExcellent thanks, and as I do the "if" I cannot detect the language in which the page is with "$language" or "$lang" and the idea is the following:
<li class="<?= $m == 'shop' && $v == 'products' && $this->input->get('promo') != 'yes' ? 'active' : ''; ?>">
<?php if ($language == 'spanish') { ?>
<a href="<?= site_url('productos'); ?>"><?= lang('products'); ?></a>
<?php } if ($language == 'english') { ?>
<a href="<?= site_url('products'); ?>"><?= lang('products'); ?></a>
<?php } ?>
</li> - MSAnsweredHello,
For user language, in controllers `$this->Settings->user_language` and in views `$Settings->user_language`
For default from system settings, you can use `$this->Settings->language` and `$Settings->language` - HRAnsweredDone, excellent, thank you very much.
- Login to Reply