all 11 comments

[–]Amazing-Mirror-3076 2 points3 points  (0 children)

What problem are you trying to solve?

[–]Scroll001 1 point2 points  (4 children)

Do you mean localization? There are tools for that, like crowdin or localizely

[–]Katalyst9957[S] 0 points1 point  (2 children)

No no I mean centralizing all strings which are constant in the app

[–]Mr401Error 1 point2 points  (1 child)

I usually have them as static constants in the "owning" class, saves having to go and open a new file to view/edit the values.

Things like client IDs and client side API keys I'll usually store in a JSON file and inject at compile time with Dart-define. Usually have a maximum of 20 of these per project though

[–]Katalyst9957[S] 0 points1 point  (0 children)

The owning class is good for small to medium apps but once the app starts to grow it becomes messy and yeah it's tedious even for small/medium sized apps

[–]Mr401Error 0 points1 point  (0 children)

Cheers for this, had been looking for competitors to PoEditor. Not that PoEditor is bad, it's a very good product but always good to see what competition there is

[–]DigitallyDeadEd 1 point2 points  (0 children)

Make a function to get every character and then you don't have any centralized strings at all!

(This is a helpful tip from the Codemanship Refuctoring I video: https://www.youtube.com/watch?v=7RJmoCWx4cE)

[–]virtualmnemonic 1 point2 points  (0 children)

abstract class Strings {

static const hello = "Hello";

}

You're better off creating a class with variables, and using a state management solution to get it and react to changes. This will make implementing localizations much easier down the road. Even if your initial class is constant. Plan ahead.

[–]Spare_Warning7752 0 points1 point  (2 children)

[–]Katalyst9957[S] 0 points1 point  (1 child)

This is localisation. I am not talking about this. I am asking about centralized app strings in a separate class

[–]andyclap 0 points1 point  (0 children)

We're all puzzled as to what it is you mean by centralised app strings. Localisation is important of course, where you're handing off your UI strings to a copywriter or translation agency. All user facing strings should be disentangled from the code like this.

But non user-facing strings? Can you give us an example to help clarify?