Fix locale-specific copied view detection in count_copied_views#3175
Fix locale-specific copied view detection in count_copied_views#3175jmcouffin merged 2 commits intopyrevitlabs:developfrom
Conversation
There was a problem hiding this comment.
PR Summary:
- Expands
count_copied_viewsto detect locale-specific Revit view copy suffixes beyond English/French - Covers ~12 locales including German, Spanish, Russian, Japanese, Chinese Simplified, Korean, Hungarian, etc.
- Non-ASCII strings written as Unicode escapes for IronPython 2.7 safety
- Removes the original
# FIXMEcomment
Review Summary:
The direction of this fix is correct and welcome. However, there are two significant bugs: the Chinese Simplified entry uses the wrong word (复制 is the verb "to copy" the command, whereas Revit actually appends 副本 as the noun suffix when duplicating views — confirmed via web research). Additionally, the pure substring matching strategy (name in view_name) is fragile across all locales: short tokens like "Kopi" can match unintended view names (e.g., a view named "Topikon Section" would be flagged), and even "Copy" would match a legitimate view named "Copy Protection Plan". Anchoring the match to Revit's known "<name> <CopyWord> <N>" suffix pattern with a regex would eliminate false positives entirely.
Follow-up suggestions:
@devloaifix the identified issues: replace the Chinese Simplified entry with"\u526f\u672c"(副本), and refactor the substring match to use a regex anchored to Revit's"<name> <CopyWord> <N>"suffix format
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26073+1714-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26073+2220-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26074+1648-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26076+0001-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26077+2319-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26079+2333-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26080+1314-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2031-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2042-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2045-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2048-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2106-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2130-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26086+2004-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26088+1318-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26089+1231-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+0549-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1533-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1536-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1556-wip |
|
📦 New public release are available for 6.2.0.26090+1754 |
Description
The function previously only caught English ("Copy") and French ("Copie")
view name suffixes. This resolves the FIXME by expanding the match list to
cover all known Revit UI locales: German/Dutch/Czech (Kopie), Spanish/
Italian/Portuguese (Copia), Polish/Swedish (Kopia), Norwegian/Danish (Kopi),
Finnish (Kopio), Russian, Japanese, Chinese Simplified, Korean, and Hungarian.
Non-ASCII strings are written as Unicode escapes to remain safe in IronPython
2.7 regardless of the source file's declared encoding.
Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}