Shopify / Shopify/liquid

`number_of_words` doesn't support languages that don't use space separator.

Open
#984 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request International
Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

number_of_words doesn't support languages that don't use space as separator.

English

    {{'The quick brown fox jumps over the lazy dog' | size}} //43
    {{'The quick brown fox jumps over the lazy dog' | number_of_words}} //9

Arabic I'm not sure if الكسول` counts as 1 or 6 word(s).

    {{'الثعلب البني السريع يقفز فوق الكلب الكسول' | size}} //41
    {{'الثعلب البني السريع يقفز فوق الكلب الكسول' | number_of_words}}  //7

Japanese

    {{'クイックブラウンキツネは怠惰な犬の上を飛ぶ' | size}} //21
    {{'クイックブラウンキツネは怠惰な犬の上を飛ぶ' | number_of_words}} //1

Korean. I'm not sure if 빠른 갈색 counts as 2 or 4 words.

    {{'빠른 갈색 여우는 게으른 개를 뛰어 넘습니다' | size}} //24
    {{'빠른 갈색 여우는 게으른 개를 뛰어 넘습니다' | number_of_words}} //7

Chinese.

    {{'敏捷的棕毛狐狸从懶狗身上跃过' | size}} //14
    {{'敏捷的棕毛狐狸从懶狗身上跃过' | number_of_words}} //1

Maybe worth looking at https://github.com/jpatokal/script_detector.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the number_of_words filter and compare its current results with the English, Arabic, Japanese, Korean, and Chinese examples in the issue. Clarify with maintainers how words should be defined for languages without spaces, then determine the expected behavior and add coverage for the agreed cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
internationalization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.