Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

Forums OroPlatform OroPlatform – How do I? Questions Countriy & region names

This topic contains 7 replies, has 3 voices, and was last updated by Yevhen Shyshkin Yevhen Shyshkin 4 years, 3 months ago.

  • Creator
    Topic
  • #2775
    hirokazu_n
    hirokazu_n
    Participant

    Hi,
    I tried to translate country and region names, but they were not translated.
    Does anyone know how to do it?

    I just copied “vendor/oro/platform/src/Oro/AddressBundle/Resources/translations/entities.en.yml” to “app/Resources/AddressBundle/translations/entities.ja_JP.yml” and translate some country and regions.
    After cleared app cache, I reload my browser, but nothing changed.

    Also, I created “name_format.yml” in my custom bundle for changing name format. I think “name_format.yml” can change name format, but these places are still same,

    • contact address
    • account

    How should I do?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #2776
    Dima Soroka
    Dima Soroka
    Keymaster

    hi Hirokazu

    Currently we have a couple of issues with showing translations of countries and region names, we are going to fix them before the April release.

    In order to change address format you should use address_format.yml. In order to apply updated localization settings you should run cache:clear and oro:localization:dump commands.

    #2777
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    > Also, I created “name_format.yml” in my custom bundle for changing name format. I think “name_format.yml” can change name format, but these places are still same

    If you want to format names inside addresses you should know that addresses are formatting by country and address names are formatting using country locale. Addresses can be formatting either using address location (address country), or according to system configurured location (in System Configuration).

    For example, you have ja locale, JP country and “Format address by address country” is checked. Then regular entity names (contact, lead etc.) will be formatted using ja locale name format from name_format.yml. Addresses will be formatted using address formats for address country, so USA addresses will be formatted using USA address format and address name will be formated using en_US locale (from locale_data.yml), and Japan addresses will be formatted using Japan address formats and address names will be formatted using ja locale (also from locale_data.yml). If you want to format all addresses using JP country regardless of the address country, you have to uncheck option “Format address by address country”.

    All locale data information (files address_format.yml, currency_data.yml, locale_data.yml, name_format.yml) can be overriden in other bundles by simple adding of file with the same name that contains new data under required key.

    #2778
    hirokazu_n
    hirokazu_n
    Participant

    Hi,

    Thanks and sorry to late reply.
    After 1.0.0, I added some translated entries into oro_dictionary_region_trans, and successfully region names were translated. It seems works fine, but another problem happened.
    The sql that getting region list uses “COALESCE(t1_.content, o0_.name) ASC”, but I hope to use combined_code because most of our customers may feel strange if region names are sorted by alphabetically (We usually sort region name from northern to southern).

    How do I implement modified code in my bundle to fix this issue?

    #2779
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    To fix this issue you have to customize data column used for sorting, f.e.
    sorters:
    columns:
    ...
    regionLabel:
    data_name: region.combinedCode

    So, in SQL you’ll receive:ORDER BY o4_.combined_code ASC

    You can do it using extending of grid or custom grid listener.

    #2780
    hirokazu_n
    hirokazu_n
    Participant

    Thank you! will try it.

    #2781
    hirokazu_n
    hirokazu_n
    Participant

    Oops, I forgot to explain my issue completely.
    I’d like to change “order by” condition for region select, too. (ex. create contact form)

    How should I do?

    #2782
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    If you want to do it all over the system then you have to look at RegionRepository::getCountryRegionsQueryBuilder and customize it. Unfortunately, I don’t know clear way to do that.

    If you want to change it only on forms you should look at AddressCountryAndRegionSubscriber::getRegionClosure – it returns query builder that you can customize.

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No
ssossossossosso