Home > Back-end >  Database in foreign Language, while sourcecode in english?
Database in foreign Language, while sourcecode in english?

Time:10-11

Is it possible to have my database, table and column names in my native Language, and when having to access the the database in the sourcecode, translate them to english?

The thing the firm wants the database to be in native language, since it makes more sense. This would mean the sourcecode would be a mix of english and the native language.

I know you can use a tranlsator class for the frontend, but is something similar available for database/sourcecode?

Best Regards Duc Anh

CodePudding user response:

It's not a good idea and you shouldn't do that. You can have your DB schema in the native language, but then the source code should use exactly the same schema. Translating it can be error prone and confusing, so I'd advocate against it.

If you still want to go with it, I believe you can use SQL's VIEW statement and https://www.w3schools.com/sql/sql_alias.asp

CodePudding user response:

The answer to this question should be YES. But unfortunately it's "Most likely". If you are using 3rd party libraries to read from the database, that may prevent you from doing so.

It should be YES because it's an internationalisation issue. We all agree that we should be building good user facing UIs with internationalisation support, but for some reason we don't think the back end is worthy of such?

Anyway, If you are using Entity Framework or similar, you can simply rename the objects in the model. The underlying table name has nothing to do with the collections or record names.

If you are hand-rolling your own SQL, then declare yourself some public static String variables and use those in your string concatenations. If you create a service interface to fetch the strings, then you could load a French translation for the instance your client is running while allowing your developers to code in their preferred language.

You could also look at creating a French schema that aliases the English tables (or visa-versa), allowing them to look at their database in their native language.

I'm sure there are many, many, other options.

  • Related