# Slug and multilanguages

**URL:** <https://forum.getkirby.com/t/slug-and-multilanguages/13381>\
**Category:** Questions\
**Tags:** v3\
**Created:** [March 14, 2019, 4:41pm UTC](https://forum.getkirby.com/t/slug-and-multilanguages/13381 "2019-03-14T16:41:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thkm](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thkm/32/6252_2.png) [@thkm](https://forum.getkirby.com/u/thkm)\
**Post date:** [March 14, 2019, 4:41pm UTC](https://forum.getkirby.com/t/slug-and-multilanguages/13381/1 "2019-03-14T16:41:49Z")

</div>

Hi,

I have a problem similiar to [this post](https://forum.getkirby.com/t/nav-items-in-forloop-with-section-ids-in-multiple-languages/7879) and it seems that `str::slug()`doesn’t work with chinese either.

So my question is, how I can use `slug()` to use my default language?  
I use a one pager template and my code looks like this:

```auto
<?php
  $categories = $data->categories()->toStructure();
  $selected = $categories->first();
?>

<ul>
  <?php foreach ($categories as $category): ?>
    <li class="tab <?= $category == $selected ? 'is-selected' : '' ?>">
      <a href="<?= $site->defaultLanguage('en')->url() . '/#' . str::slug($category->title()) ?>">
        <?= $category->title()->html() ?>
      </a>
    </li>
  <?php endforeach ?>
</ul>

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 14, 2019, 4:51pm UTC](https://forum.getkirby.com/t/slug-and-multilanguages/13381/2 "2019-03-14T16:51:27Z")

</div>

Let’s start with a little fix:

It should be

```auto
$kirby->defaultLanguage()

```

not `$site` and the `defaultLanguage()` method doesn’t accept a parameter (there is only one default language).

What is the result you get from `str::slug($category->title())`?

---

<div class="post-metadata">

**Author:** ![thkm](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thkm/32/6252_2.png) [@thkm](https://forum.getkirby.com/u/thkm)\
**Post date:** [March 14, 2019, 5:00pm UTC](https://forum.getkirby.com/t/slug-and-multilanguages/13381/3 "2019-03-14T17:00:07Z")

</div>

I’ve fixed the code

```auto
...
<a href="<?= $kirby->defaultLanguage()->url() . '/#' . str::slug($category->title()) ?>">
  <?= $category->title()->html() ?>
</a>
...

```

I get the desired result for two languages but for the chinese I get nothing `#`

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 14, 2019, 5:03pm UTC](https://forum.getkirby.com/t/slug-and-multilanguages/13381/4 "2019-03-14T17:03:51Z")

</div>

You probably need a custom sluggify method for Chinese. Since I’m not familiar with it at all, I can’t give advice how to create a proper slug in Chinese.

---

<div class="post-metadata">

**Author:** ![thkm](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thkm/32/6252_2.png) [@thkm](https://forum.getkirby.com/u/thkm)\
**Post date:** [March 14, 2019, 5:10pm UTC](https://forum.getkirby.com/t/slug-and-multilanguages/13381/5 "2019-03-14T17:10:58Z")

</div>

Thanks, I’ll try that
