# Discourse 在执行搜索时应忽略字符的重音符号

**URL:** https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198
**Category:** Feature
**Tags:** search, completed
**Created:** [2018 年6 月 19 日 10:52 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198 "2018-06-19T10:52:24Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018 年8 月 31 日 07:39 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/22 "2018-08-31T07:39:40Z")

</div>

If you really want to push this forward prior to release, I am open to a site setting here. I guess we can live with one less translation if people do not pick it in time, but it must be enabled specifically in languages that we know need this, rather than globally.

@Falco, what is your call for Portuguese?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2018 年8 月 31 日 13:40 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/23 "2018-08-31T13:40:45Z")

</div>

> [@sam](#):
>
> @Falco what is your call in Portuguese?

Same as French. People never type accents when doing a quick search.

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [2018 年8 月 31 日 15:12 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/24 "2018-08-31T15:12:56Z")

</div>

> [@sam](#):
>
> I guess we can live with one less translation if people do not pick it in time

We are talking about a string in admin section, right? 🙂

> **[The Ugly American Programmer](https://blog.codinghorror.com/the-ugly-american-programmer/)**
>
> On the internet, you can pretend the world is flat. Whatever country you live in, whatever language you speak, you have the same access to the accumulated knowledge of the world as every other citizen of the planet Earth. And a growing percentage of...

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [2018 年8 月 31 日 21:09 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/25 "2018-08-31T21:09:19Z")

</div>

My take is that what Sam means by “one less translation” has to do with the setting’s token-value pair. eg.  
`ignore_accents: 'ignore accents in search'`

So, say for French, that might (a total google translate guess here) be more like  
`ignore_accents: 'ignorer les accents dans la recherche'`

The blog post you linked to is more like why it wouldn’t be like  
`ignorer_les_accents: 'ignorer les accents dans la recherche'`

To get to the point, if a site was the French locale, but had not pulled in the new token-value with the translation in their locale yml file, the fallback would be to display the English text. It would look out of place, but it would be only “one translation”.

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [2018 年8 月 31 日 21:53 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/26 "2018-08-31T21:53:18Z")

</div>

Yes, I understand that, but my point was different.

I was partly joking, but merely pointing out that the untranslated string would be visible only to forum admins, who supposedly should have at least rudimentary English knowledge anyway.

If we are weighing alternatives for major release, then working search seems like a much bigger deal then one untranslated string.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018 年8 月 31 日 21:55 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/27 "2018-08-31T21:55:48Z")

</div>

We also need to walk through every locale we have (there are quite a lot) and make a reasonable informed decision about if we enable the feature or not.

A list here would help

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [2018 年8 月 31 日 21:58 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/28 "2018-08-31T21:58:07Z")

</div>

Could you point us to the list of currently available Discourse locales? I can help with the Slavic ones.

EDIT: Sorry, perhaps I misunderstood and you are asking for the same list…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018 年8 月 31 日 22:10 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/29 "2018-08-31T22:10:27Z")

</div>

our master list is at [https://github.com/discourse/discourse/blob/master/config/locales/names.yml](https://github.com/discourse/discourse/blob/master/config/locales/names.yml)

Reading [Diacritic - Wikipedia](https://en.m.wikipedia.org/wiki/Diacritic) shows how complex the situation of stripping diacritics is also not great for Scandinavian languages, this is a hairy issue

In Hebrew for example you probably would not strip since zero people write with diacritics online, so a bunch of domain knowledge is required

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [2018 年8 月 31 日 22:12 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/30 "2018-08-31T22:12:55Z")

</div>

> [@danekhollas](#):
>
> untranslated string would be visible only to forum admins

I wasn’t sure. If an Admin Setting, then yes. If a Search page option, then no.

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [2018 年8 月 31 日 22:39 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/31 "2018-08-31T22:39:46Z")

</div>

Thanks, will have a look tomorrow. Agree it is not simple, but to be on the safe side, we can leave the default off for most langs and keep the decision on admins.

I think German is another one, do we have somebody to confirm? 🙂 @tobiaseigen sounds like a German name perhaps? 🧐🙂

Hungarian and Turkish are also strong candidates, I will ask around.

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [2018 年8 月 31 日 22:42 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/32 "2018-08-31T22:42:15Z")

</div>

I wonder, is there a way to find out what Google does for each language? Seems like a good benchmark.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018 年9 月 2 日 07:16 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/33 "2018-09-02T07:16:08Z")

</div>

I suspect that Google has an automatic per word heuristic that is language neutral. I doubt we have any chance in matching what they do.

@Osama / @Pad_Pors what is the correct thing to do in Arabic, I can see plenty of diacritics in [macdiscussions.udacity.com](http://macdiscussions.udacity.com) but not sure which ought to be stripped for search and which should be kept in tact.

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [2018 年9 月 2 日 10:00 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/34 "2018-09-02T10:00:10Z")

</div>

In Arabic we almost never type diacritics in day-to-day communications, because an Arabic diacritic is separate character that you need to type in addition to the base character you want to add the diacritic to, you can imagine you painful that is. So I’d expect search engines to always find results with and without diacritics whether I type diacritics or not.

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [2018 年9 月 2 日 10:25 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/35 "2018-09-02T10:25:18Z")

</div>

the same as @Osama has described goes for Persian locale (fa\_IR), people rarely type diacritics; neither in search terms nor in their daily dialogues.

so I’d say one can forget about them at least for this locale.

---

<div class="post-metadata">

### Author: ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)
#### Post date: [2018 年9 月 3 日 10:05 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/36 "2018-09-03T10:05:01Z")

</div>

Okay, from discussion above it seems stripping diacritics for search should be enabled by default at least for:

French, Portugal (and by extension Spanish as well I guess), Arabic, Farsi, Czech.

I have it on good authority that Turkish should be stripped as well. Hungarian most probably as well, but would be good to have additional confirmation, maybe @asrob could confirm?

From the other langs from the list, I can definitely say that Slovak should be included (very very similar to Czech) and most probably Polish and Slovene as well.

---

<div class="post-metadata">

### Author: ![chrispanag](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrispanag/32/105853_2.png) [@chrispanag](https://meta.discourse.org/u/chrispanag)
#### Post date: [2018 年9 月 5 日 22:12 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/37 "2018-09-05T22:12:45Z")

</div>

@danekhollas Also, the **Greek** language needs to be included in that list.

---

<div class="post-metadata">

### Author: ![TheBestPessimist](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thebestpessimist/32/247704_2.png) [@TheBestPessimist](https://meta.discourse.org/u/TheBestPessimist)
#### Post date: [2018 年9 月 6 日 05:08 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/38 "2018-09-06T05:08:22Z")

</div>

În română, poți elimina toate diacriticele: putem scrie și citi cu literele englezești fără niciun problemă.

---

<div class="post-metadata">

### Author: ![icaria36](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/icaria36/32/426431_2.png) [@icaria36](https://meta.discourse.org/u/icaria36)
#### Post date: [2018 年9 月 10 日 10:24 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/39 "2018-09-10T10:24:35Z")

</div>

> [@danekhollas](#):
>
> (and by extension Spanish as well, I suppose)

Same with Catalan

(20 chars)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2018 年9 月 13 日 17:29 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/40 "2018-09-13T17:29:23Z")

</div>

The PR is up 👍

[https://github.com/discourse/discourse/pull/6397/files](https://github.com/discourse/discourse/pull/6397/files)

---

<div class="post-metadata">

### Author: ![Bretty](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@Bretty](https://meta.discourse.org/u/Bretty)
#### Post date: [2018 年9 月 14 日 02:22 UTC](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198/41 "2018-09-14T02:22:56Z")

</div>

While I’m not involved in this i18n, it has been a most interesting discussion to learn about how other languages are actually written. Thanks to everyone who shared their written language perspective. A virtual like to all of you! 🙂

[Previous page](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198.md?page=1)

[Next page](https://meta.discourse.org/t/discourse-should-ignore-if-a-character-is-accented-when-doing-a-search/90198.md?page=3)
