Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Localizable pages #8

Open
majkinetor opened this issue Jun 26, 2015 · 0 comments
Open

Localizable pages #8

majkinetor opened this issue Jun 26, 2015 · 0 comments

Comments

@majkinetor
Copy link

Is it possible to support localizable pages?

For instance this didn't work for me

activate :pagination do
pageable_resource :recipes do |page|
    # Match any page that lives in the "recipes" directory
    page.url.include?("/recipes/")
end
end

With the following file structure (1 file for each recipe in given locale)

source
+---localizable
¦   ¦   all_recipes.html.haml
¦   +---recipes
¦           apple_pie.en.html.md
¦           apple_pie.sr.html.md
¦           apple_pie.es.html.md
¦           backon.en.html.md
¦           cake.en.html.md

Above setup will generate resources:

/en/all_recipes.html
/en/recipes/apple_pie.html
/en/recipes/backon.html
/en/recipes/cake.html
/sr/all_recipes.html
/sr/recipes/apple_pie.html
/es/all_recipes.html
/es/recipes/apple_pie.html

all_recipes.html.haml (1 file for all locales)


---
pagination:
for: recipes
per_page: 2

---

.pager
- pagination.each do |recipe|
    .pager_item{style:'padding:15px;'}
    = link_to recipe.data.title, recipe.url

.pager_menu
= link_to t('pager.first'), pagination.first_page.url
= link_to t('pager.previous'), pagination.prev_page.url if pagination.prev_page
= link_to t('pager.next'), pagination.next_page.url if pagination.next_page
= link_to t('pager.last'), pagination.last_page.url
= "(%s %s %s)" % [pagination.page_num, t('pager.of'), pagination.total_page_num
@majkinetor majkinetor changed the title Localizable Localizable pages Jun 26, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant