0

Is it possible to translate cities as normal text without duplicating any table on the DB and only add the cities and their translations to .po here is a loop to list all the cities

<select name="sCity" class="selectar"  id="Scity">
<option value=""><?php _e('Select a city...')?></option>
<?php foreach($aCities as $city) { ?>
<option value="<?php echo $city['s_name'] ; ?>"><?php echo $city['s_name'] ; ?></option>
<?php } ?>

I tried this but didn't work

sprintf(__('%s'),  $city['s_name']);
yes_in
  • 11
  • 2
  • 5

1 Answers1

1

This is not possible to translate those since there's currently no tables for it in the Osclass database.

To make it possible, you'll need to add at least two tables: oc_t_city_description, oc_t_region_description

The structure of those new tables will be similar to oc_t_pages_description.

Something like fk_i_pages_id, fk_c_locale_code, s_title.

You might wan't to ask Osclass team on the github of the project, by submitting an issue.

-

About your test :

sprintf(__('%s'),  $city['s_name']);

Gettext does not execute PHP to make the translation, you're just asking him to translate '%s' and not 'Paris', 'London' or 'San Francisco'.

Hussard
  • 656
  • 7
  • 14