Adding language

Hello, please advice how do I add new language for selfhosted v5, I see the language in Invoice Ninja localization | Transifex it about 20% and I cannot work to complete it but I can do as I needed only on my own IN installation.

I am just a regular user with cpanel hosting and installed IN via softaculous and I can make changes on file manager and the also database.

Thank you.

Hi,

@david can you please advise?

1 Like

Hi There,

What is blocking you from updating the Transifex strings directly? We manage all of our translations through Transifex.

@david I see it about 3805 Untranslated and if I translate all with average 2 minutes per translation, it will require 380 hours, and I do not have that much patient and time.

So I was thinking if I can only translate things I need in my own IN installation will be efficient and problem solving at this moment, of course I want to help translating in that transifex but it needs time.

@cumaweb

Understood, the issue for us is that we don’t have a way to move the translations from the language files back into Transifex.

Thank you for you understanding.

Please advice how do I add the language for my own IN translation, I explain my situation above.

Thank you @david

You would need to add a new language row to the languages table

the format would be like this

[‘id’ => 33, ‘name’ => ‘Your Language’, ‘locale’ => ‘the iso 3166 2 locale code’],

then in the lang directory, you would create a folder named the iso 3166 2 locale code for your language.

Inside there you would create a texts.php file, you would need to copy one from another folder as it contains all of the keys and then replace the keys.

Here is why all of this is a terrible idea.

  1. You would need to manually check for future language additions.
  2. Only the API and Client Portal language translations would appear, none of the translations would be present in the admin portal.
  3. If in the future we add languages into the official repository, your migrations will break as you have hardcoded a language into the system.

@hillel can you advise if a user selects a language in the AP which the AP does not have translations for, will the AP fall back to english? or will it error?

I believe it should fall back to English but I haven’t tested it.

Thank you @david but are you sure the id set 33 while its been 37 languages as shown bellow.
image

Thank you @david and @hillel
I finally made it and here is what I do for those who wants to do as I do.

iso 3166 2 locale code for Indonesian is ID

So I create new row in language
INSERT INTO languages (id, name, locale) VALUES (‘38’, ‘Indonesian’, ‘ID’);

Make new folder named ID and and copy all content from en folder and make my own translation on texts.php

Then logout and login and the update with secret and there you go the new translation in localization

Once again thank you, I know the admin is still English which does not matter but the client interface is now in local language.

PROBLEM SOLVED