Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M2.2.3 directory_country_region_name locale fix? 8bytes zh_Hans_CN(11bytes) ca_ES_VALENCIA(14bytes) #14001

Closed
jiyun opened this issue Mar 8, 2018 · 5 comments
Assignees
Labels
Component: Directory Fixed in 2.4.x The issue has been fixed in 2.4-develop branch help wanted Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: PR Created Indicates that Pull Request has been created to fix issue Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@jiyun
Copy link

jiyun commented Mar 8, 2018

Preconditions

Perhaps it is English, French, German, Italian and so Latin. Shorthand notation is short (en_US 5 bytes)
The various dialects of Chinese are limited by the length of the field? zh_Hans_CN(11bytes) ca_ES_VALENCIA(14bytes)

directory_country_region_name locale 8bytes

Steps to reproduce

zh_Hans_CN” ->directory_country_region_name locale == “zh_Hans_
Invalid after restricted character truncation

Problem path:
app/code/Magento/Directory/Setup/InstallSchema.php:143

        $table = $installer->getConnection()->newTable(
            $installer->getTable('directory_country_region_name')
        )->addColumn(
            'locale',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            8,
            ['nullable' => false, 'primary' => true, 'default' => false],
            'Locale'

Expected result

Change to 14 known valid byte or 16? or only 11 bytes of Chinese zh_hans_xx

Just change it. We are doing Chinese localization Magento2 will be convenient for many

Actual result

New additional data
app/code/Magento/Directory/Setup/InstallSchema.php

//中国省级地址
        $datacn = [
            ['CN','11','BJ','京','Beijing','北京市'],
            ['CN','12','TJ','津','Tianjing','天津市'],
            ['CN','13','HE','冀','Hebei','河北省'],
            ['CN','14','SX','晋','Shanxi','山西省'],
            ['CN','15','NM','蒙','Inner Mongoria','内蒙古自治区'],
            ['CN','21','LN','辽','Liaoning','辽宁省'],
            ['CN','22','JL','吉','Jilin','吉林省'],
            ['CN','23','HL','黑','Heilongjiang','黑龙江省'],
            ['CN','31','SH','沪','Shanghai','上海市'],
            ['CN','32','JS','苏','Jiangsu','江苏省'],
            ['CN','33','ZJ','浙','Zhejiang','浙江省'],
            ['CN','34','AN','皖','Anhui','安徽省'],
            ['CN','35','FJ','闽','Fujian','福建省'],
            ['CN','36','JX','赣','Jiangxi','江西省'],
            ['CN','37','SD','鲁','Shandong','山东省'],
            ['CN','41','HA','豫','Henan','河南省'],
            ['CN','42','HB','鄂','Hubei','湖北省'],
            ['CN','43','HN','湘','Hunan','湖南省'],
            ['CN','44','GD','粤','Guangdong','广东省'],
            ['CN','45','GX','桂','Guangxi','广西壮族自治区'],
            ['CN','46','HI','琼','Hainan','海南省'],
            ['CN','50','CQ','渝','Chongqing','重庆市'],
            ['CN','51','SC','川','Sichuan','四川省'],
            ['CN','52','GZ','贵','Guizhou','贵州省'],
            ['CN','53','YN','云','Yunnan','云南省'],
            ['CN','54','XZ','藏','Tibet','西藏自治区'],
            ['CN','61','SN','陕','Shaanxi','陕西省'],
            ['CN','62','GS','甘','Gansu','甘肃省'],
            ['CN','63','QH','青','Qinghai','青海省'],
            ['CN','64','NX','宁','Ningxia','宁夏回族自治区'],
            ['CN','65','XJ','新','Xinjiang','新疆维吾尔自治区'],
            ['CN','71','TW','台','Taiwan','台湾省'],
            ['CN','81','HK','港','Hong Kong','香港特别行政区'],
            ['CN','82','MO','澳','Macao ','澳门特别行政区']
//ISO标准国家缩写0,国标省级数字编码1,国标省级域名缩写2,国标省级单字缩写(车牌)3,国标省级英文4,国标省级全称5。
		];
        foreach ($datacn as $row) {
            $bind = ['country_id' => $row[0], 'code' => $row[2], 'default_name' => $row[4]];
            $setup->getConnection()->insert($setup->getTable('directory_country_region'), $bind);
            $regionId = $setup->getConnection()->lastInsertId($setup->getTable('directory_country_region'));
            $bind = ['locale' => 'en_US', 'region_id' => $regionId, 'name' => $row[4]];
            $setup->getConnection()->insert($setup->getTable('directory_country_region_name'), $bind);
            $bind = ['locale' => 'zh_Hans_CN', 'region_id' => $regionId, 'name' => $row[5]];
            $setup->getConnection()->insert($setup->getTable('directory_country_region_name'), $bind);
        }

Error effect
1

Before
Database pic
1
2

Target effect
2

Modified After
Database pic
3
4

@magento-engcom-team magento-engcom-team added the Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed label Mar 8, 2018
@jiyun
Copy link
Author

jiyun commented Mar 8, 2018

Error effect
1

Before
Database pic
1
2

Target effect
2

Modified After
Database pic
3
4

@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Mar 9, 2018
@magento-engcom-team
Copy link
Contributor

@jiyun, thank you for your report.
We've acknowledged the issue and added to our backlog.

@engcom-Echo engcom-Echo removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Dec 30, 2019
@engcom-Echo engcom-Echo self-assigned this Dec 30, 2019
@m2-assistant
Copy link

m2-assistant bot commented Dec 30, 2019

Hi @engcom-Echo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Echo engcom-Echo added help wanted Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels Dec 30, 2019
@magento-engcom-team magento-engcom-team added Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Dec 30, 2019
@engcom-Echo engcom-Echo added Component: Directory Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Dec 30, 2019
@ghost ghost unassigned engcom-Echo Dec 30, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Echo
Thank you for verifying the issue. Based on the provided information internal tickets MC-30122 were created

Issue Available: @engcom-Echo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Bartlomiejsz added a commit to Bartlomiejsz/magento2 that referenced this issue Jan 5, 2020
…8bytes zh_Hans_CN(11bytes) ca_ES_VALENCIA(14bytes)
@ghost ghost assigned Bartlomiejsz Jan 5, 2020
@Bartlomiejsz Bartlomiejsz added the Progress: PR Created Indicates that Pull Request has been created to fix issue label Jan 5, 2020
@VladimirZaets
Copy link
Contributor

Hi @jiyun. Thank you for your report.
The issue has been fixed in #26268 by @Bartlomiejsz in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.0 release.

@VladimirZaets VladimirZaets added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Jan 8, 2020
magento-engcom-team added a commit that referenced this issue Jan 8, 2020
… fix? 8bytes zh_Hans_CN(11bytes) ca_ES_VALENCIA(14bytes) #26268

 - Merge Pull Request #26268 from Bartlomiejsz/magento2:feature/fix_14001_directory_country_region_name_locale_length
 - Merged commits:
   1. 5fe7454
magento-engcom-team pushed a commit that referenced this issue Jan 8, 2020
… fix? 8bytes zh_Hans_CN(11bytes) ca_ES_VALENCIA(14bytes) #26268
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Directory Fixed in 2.4.x The issue has been fixed in 2.4-develop branch help wanted Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: PR Created Indicates that Pull Request has been created to fix issue Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
None yet
Development

No branches or pull requests

5 participants