Skip to content

Fix locale-specific copied view detection in count_copied_views#3175

Merged
jmcouffin merged 2 commits intopyrevitlabs:developfrom
Wurschdhaud:fixme-count-copied
Mar 14, 2026
Merged

Fix locale-specific copied view detection in count_copied_views#3175
jmcouffin merged 2 commits intopyrevitlabs:developfrom
Wurschdhaud:fixme-count-copied

Conversation

@Wurschdhaud
Copy link
Copy Markdown
Contributor

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:

  • Code follows the PEP 8 style guide.
  • Code has been formatted with Black using the command:
    pipenv run black {source_file_or_directory}
  • Changes are tested and verified to work as expected.

Copy link
Copy Markdown
Contributor

@devloai devloai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary:

  • Expands count_copied_views to 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 # FIXME comment

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:

  • @devloai fix 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

@jmcouffin jmcouffin merged commit 7a7ccb7 into pyrevitlabs:develop Mar 14, 2026
@Wurschdhaud Wurschdhaud deleted the fixme-count-copied branch March 14, 2026 17:18
@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26073+1714-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26073+2220-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26074+1648-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26076+0001-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26077+2319-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26079+2333-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26080+1314-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2031-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2042-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2045-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2048-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2106-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2130-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26086+2004-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26088+1318-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26089+1231-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+0549-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1533-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1536-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1556-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New public release are available for 6.2.0.26090+1754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants