Skip to content

Update function descriptions to match actual behavior - #21

Merged
m-shichida merged 2 commits into
mainfrom
update_function_descriptions
Oct 26, 2026
Merged

m-shichida merged 2 commits into
mainfrom
update_function_descriptions

Conversation

@m-shichida

Copy link
Copy Markdown
Contributor

Background

The function descriptions in lib/xls_function/locales/*.yml were mostly based on Microsoft Excel's documentation.
Some of them did not match how this library actually behaves, so users could not rely on them.

Changes

  • Rewrote every description in ja.yml based on the implementation in lib/xls_function/evaluators/functions/.
  • Updated en.yml as a translation of the new ja.yml, so both locales describe the same behavior.
  • Only the descriptions text changed. No code changes, and no keys were added or removed (57 descriptions in each file). errors is unchanged.

Examples of descriptions that now match the actual behavior:

Function Previous description Actual behavior (now documented)
DBCS Converts half-width letters to full-width Only uppercase letters, digits, and katakana are converted
LEFT / RIGHT num_chars is optional Omitting num_chars returns #VALUE!
AND / OR (not mentioned) Arguments are evaluated left to right and stop once the result is decided
IFS (not mentioned) Returns empty (nil) when no condition is TRUE
SWITCH Unclear signature Returns #N/A when nothing matches and no default is given
ISNUMBER (not mentioned) A string of digits such as "123" returns FALSE
CHAR Any number Use 0-127 (ASCII). Use UNICHAR for other characters

How to verify

Anyone can check the behavior described above in bin/console:

XlsFunction.evaluate('DBCS("abcABC123")')     # => "abcABC123"
XlsFunction.evaluate('LEFT("abc")')           # => "#VALUE!"
XlsFunction.evaluate('AND(FALSE, 1/0)')       # => false (1/0 is not evaluated)
XlsFunction.evaluate('IFS(FALSE, 1)')         # => nil
XlsFunction.evaluate('SWITCH(3, 1, "a", 2, "b")') # => "#N/A"
XlsFunction.evaluate('ISNUMBER("123")')       # => false
XlsFunction.evaluate('EDATE("2026/1/31", 1)') # => 0.4608e5 (serial number of 2026/2/28)

To see the descriptions in each locale:

I18n.locale = :en
XlsFunction.functions['DBCS'][:description]
# => "DBCS(text) Converts half-width uppercase letters, digits, and katakana to full-width."

I18n.locale = :ja
XlsFunction.functions['DBCS'][:description]
# => "DBCS(文字列) 半角の英大文字・数字・カタカナを全角に変換します。"

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@m-shichida m-shichida self-assigned this Oct 26, 2026
@m-shichida
m-shichida merged commit 5c5b193 into main Oct 26, 2026
5 checks passed
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