I use http://www.symfony-project.org/plugins/tmcI18nPlugin plugin for internationalization.
Is there a way do not show the default language in url?
for example if i have
faq:
url: :sf_culture/faq
param: { module: faq, action: index}
English culture must miss for default language.
Related
I need to export a static site to AWS S3 from a nextjs project. In order to handle next export I don't have the possibility to use normal internationalisation.
So what I did is to create my blog in English and create a folder /fr/ which contains the same pages translated. It's not a big deal, since it's a presentation website I have 5 pages, and the blog will be in en (not translated).
Currently nextjs is properly detecting the user language, and is sending back to the /fr/ path BUT it's reading from the index instead of reading from /fr/
So my current page is kept in en.
Is there a way to ask nextjs to read from the folder /fr ?
/** #type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
i18n: {
locales: ['en', 'fr'],
defaultLocale: 'en',
},
trailingSlash: true,
}
module.exports = nextConfig
Thanks
Some guidance for anyone having the same issue trying to build a static website in multiple languages, for very simple projects. Basically I ended up creating a folder /de/ and translate my pages there, and add a button to send users to the correct site.
It's working well because I have under 10 pages.
Even though NextJS is using /fr/ in the URL it is not using language in pages structure to locate the correct page.
If you want to continue with your approach you can use useRouter from NextJS in your pages which gives you access to router and from router you can get the active locale (see https://nextjs.org/docs/advanced-features/i18n-routing#accessing-the-locale-information). Then you can return correct content for given locale.
I need to build the following custom route pattern:
{prefix}/test/
I'm using this base module as example (https://github.com/sidharrell/D8HWexample), and already did the d9 updates.
At this moment my module's .routing.yml looks like this:
hello.content:
path: '{region}/hello'
defaults:
_controller: '\Drupal\testroute\Controller\HelloController::content'
_title: 'Hello World'
requirements:
_permission: 'access content'
But once I clear the cache, any url like /asd/hello, will fallback on 404.
When I use the wildcard as suffix, it works as expected, but I need it as an URL prefix.
I know there is a way using Event and Route Subscriber, but I'm looking for the most simple solution for that.
Any idea will be much appreciated. Please let me know if more info is needed.
PS: adding a slash before the path still returns me 404.
Example:
path: '/{region}/hello'
I usually see resource: contain a file path, but here I have a multiline string with yaml instead:
shop_admin_taxon:
resource: |
alias: sylius.taxon
section: shop
templates: AdminBundle:Taxon/Crud
except: ['show', 'index']
redirect: update
grid: shop_admin_taxon
type: sylius.resource
prefix: /
I didn't get any error messagaes about this code when it worked on Symfony 3.2.7 in another project. But now Symfony 3.4 gives me the following error when trying to read this configuration:
The file "alias: sylius.taxon section: shop templates: AdminBundle:Taxon" does not exist.
That's actually expected (since as far as I know you pass a resource locator to resource: and not the actual resource configuration), but why did it work?
Symfony is complex beast and allows a lot of tinkering with it's internals. The routing component is no exception of this and you can see usages which modify or even dynamically create routes on the fly.
This in particular looks like a Sylius extension to routing. If you are curious how precisely it works have a look at the relevant Symfony documentation page. The functionality is being provided by the SyliusResourceBundle with a custom loader.
With all this in mind it looks like you have a broken Sylius install as the custom routing loader is not working. It could be some version mismatch introduced by composer update (e.g. remove component A due to incompatibility with newer version of component B), or bundles not being enabled, or something similar. Make sure all Sylius bundles are installed and enabled
I'm new to Symfony trying to add another language version to site.
I was trying to add language version in .htaccess and locales.
I've added this strings to routing.yml:
contacts:
param: { module: homepage, action: contacts }
prefix_path: /:sf_culture/contacts
But everytime I got 404 when I go to the /en/contacts.
I need to move english version to the /en and another language keep on /
What am I doing wrong and how can I add language version to the site correctly?
I'm using symfony 1.4 (the lexpress symfony 1.5 branch) and sfPropelORMPlugin with propel 1.6
I've updated my admin generator backend to use a bootstrap3 theme using this plugin:
https://github.com/bgcc/sfBootstrapPropelAdminThemePlugin
I set the admin to use this theme in the view.yml for each generated admin module.
thus:
generator:
class: sfPropelGenerator
param:
model_class: Modelname
theme: bootstrap
Can I set the theme globally for all admin modules somehow?
I've tried copying generator.yml into the application level config and just defining the template param but symfony wants a modelname.
Thanks.
It's not possible, but if you want to override plugin's module generator.yml, you just need to create app/appName/modules/sfGuardUser/config/generator.yml file and it will be used. Copy it from plugins/sfGuardPlugin/modules/sfGuardUser/config/generator.yml and adjust. Same for other modules.