Is there no built-in localization?

Nicolas_K
Member | 25
+
0
-

This question – you might find – comes from a real beginner…:

Is it true, that there is no built-in possibility to establish localization?

The docs refer to several Componette projects where the most prominent ask for dependencies far back in the past.
(https://doc.nette.org/…on/templates#… :
There is no default implementation in Nette, you can choose according to your needs from several ready-made solutions that can be found on Componette.”)
And a link to a paid service can be found (localazy .com).

So I can't use Nette mechanisms by itself, do I? (i.e. setTranslator + translate)

Huh… I'm standing right in front of a wall…
I dealt with neon-solutions, with .po-files, but the wall stays in place…

Is there anywhere a documentation that you could send me a link to?
A clear advice how to add / change / supplement

  • the router
  • a base presenter / specialized presenters?
  • templates
  • neon- / po-files

This is my actual composer.json:

{
	"name": "Name",
	"description": "Web Project with markdown flat-files",
	"type": "project",
	"license": "none",
	"minimum-stability": "stable",
	"prefer-stable": true,
	"require": {
		"php": ">=8.1 <8.3",
		"nette/application": "^3.1",
		"nette/bootstrap": "^3.2",
		"nette/caching": "^3.2",
		"nette/database": "^3.1",
		"nette/di": "^3.1",
		"nette/forms": "^3.1",
		"nette/http": "^3.2",
		"nette/mail": "^4.0",
		"nette/neon": "^3.4",
		"nette/robot-loader": "^4.0",
		"nette/security": "^3.1",
		"nette/utils": "^4.0",
		"latte/latte": "^3.0",
		"tracy/tracy": "^2.9",
		"erusev/parsedown": "^1.7",
		"nette/safe-stream": "^3.0"
	},
	"require-dev": {
		"nette/tester": "^2.4",
		"phpstan/phpstan-nette": "^1.2"
	},
	"autoload": {
		"psr-4": {
			"App\\": "app"
		}
	}
}

And I don't want to go back to Nette 2.5 since then I had to remove the Finder which I actually use.

I would be very glad, if someone had an advise for me, how to establish localization without catching me in a jail of prescribed outdated dependencies!

Or – even better – show me the tomatoes on my eyes, that hinder me to see the simple solution..! <3

dakur
Member | 493
+
+1
-

Nette provides an interface, packages provide implementations of this interface. So no one is forced to use a solution which does not fit his needs.

You can try the second most prominent componette package – contributte/translation, that's contemporary solution. Does it fit your needs?

Last edited by dakur (2023-03-20 13:37)

David Grudl
Nette Core | 8228
+
0
-

Where is the link to the paid service?

David Grudl
Nette Core | 8228
+
0
-

Ok, but you probably googled it yourself, in the documentation there is a link to the opensource solution, right?

Nicolas_K
Member | 25
+
0
-

@DavidGrudl – Hm.. did not quite understand..
In the docs there are only internal links as far as I see, api./doc.nette and componette.
The link to localazy .com is in the forum. They have a 6-days-free-trial and then paid.
Definitely not a problem for me, – but I want to have the solution on my machine.

@dakur – thank you very much, I will try to figure that out;
only saw, that ITranslator is deprecated? (since Utils 3.2)
But that solution uses ITranslator. (In composer I have Utils 4.0 – perhaps not yet the time for it?)
I don't know. If that is actually the best way, I will try it!

Thank you both for your help!

dakur
Member | 493
+
0
-

Localazy is a software/service which helps with process of translating. Imagine it as a form with many inputs – on left there is text in original language, on right there are fields to write translation into. Plus many smart features. So it's tool primarily for translators, not programmers, I'd say, even though programmers benefit from it as well.

But what you need is implementation of localization into code which is something what old kdyby/translation and up-to-date contributte/translation do. As of the deprecation, it's just that Nette is moving from prefixing interfaces with I- letter to no prefixes. So if you need to use ITranslator in your code, just use Translator instead. If it's inside of contributte/translation, don't worry, it will be definitely updated in some of next versions.

Last edited by dakur (2023-03-21 08:08)

Nicolas_K
Member | 25
+
0
-

Great.
Again, some fog is blown off.
Many many thanks!!

dakur
Member | 493
+
0
-

You're welcome. 🙂